Easy FancyBox getElementById
-
JavaScript
function unsplitCookie() { var default_roiz = getCookie("__roiz"); if (default_roiz != null && default_roiz != "undefined") { document.getElementById("formROIVisitor").value = default_roiz; //alert(default_roiz); alert works but nothing populates in the value of the input } } jQuery(document).ready(function(){ jQuery('form.mkto').submit(function(){ unsplitCookie(); }); });
HTML of Form inside fancybox
<div style=”display:none” class=”fancybox-hidden”>
<div id=”fancyboxID-1″>`
<form class=”mkto” action=””>
<input type=”text” name=”formROIVisitor” id=”formROIVisitor” value=”” />
<button type=”submit”>Submit</button>
</form>
</div>
</div><a href=”#fancyboxID-1″ class=”fancybox-inline”>Request a Info Kit.</a>`
I get a JavaScript error using FF.
Error: TypeError: document.getElementById(…) is null
Source File: chrome://web-developer/content/overlay/javascript/overlay.js
Line: 7333When I pull the form outside of the fancy box everything works as expected. Not sure why the document.getElementById is not passing. Any suggestions would be great!
- The topic ‘Easy FancyBox getElementById’ is closed to new replies.