I have an upload form, then the submit is a link that goes to a confirm box. Both of those are made with the jquery plugin fancybox. So technically its not a confirm box, its just a div. I had my submit button in the confirm box but that didnt work in IE/FF so i used .submit() .
It works in Chrome, IE, and Firefox but i’ve heard you can never be sure with javascript. Is there a way i can be sure this will work “forever”?
<form name="importForm" action="<?=site_url('headquarters/importDesign')?>" method="POST" enctype="multipart/form-data">
<div id="import-design">
<div id="inline2">
<div class="form-section">
<ul>
<li><span class="input">File:</span><input name="userfile" size="40" type="file" /></li>
<li><span class="input">File Name:</span><input type="text" name="name" /></li>
</ul>
</div>
<div class="form-section">
<a class="various1" href="#inline3"><button>Submit</button></a>
</div>
</div>
</div>
<div id="import-confirm">
<div id="inline3">
<h2>Confirm Reset?</h2>
<p>Do you really want to proceed? All design data will be overwritten.</p>
<hr class="inv-hr" />
<div id="buttons">
<button class="float-right" onClick="window.location.href='<?=site_url('headquarters/migrationDetails')?>'">Cancel</button>
**<a href="javascript:document.importForm.submit();">Click to submit the form</a>**
</div>
</div>
</div>
</form>
The only 100% reliable way to ensure JavaScript code will work in all browsers you care about is to test it on those platforms.
There are a number of tools and services out there that try to make this easier for you. See e.g.
http://www.smashingmagazine.com/2011/08/07/a-dozen-cross-browser-testing-tools/