Reputation: 399
I'm having a real problem with JavaScript scope in IE 7.
I have declared function at top of page like following
function close_fancy()
{
$.fancybox.close();
}
called function on
<input type="reset" name="reset" id="button2" value="Close'" onclick="close_fancy();"/>
its working on all major browsers except IE-7 it throws following error
The value of the property 'close_fancy' is null or undefined, not a Function object
Please Help Me On This...
Upvotes: 2
Views: 127
Reputation: 168803
Since you're using jQuery, you should be writing it in a jQuery style.
This means not using onclick=
in the HTML code, but instead writing a $(elem).click()
function, like so:
$('#button2').click(function() {
$.fancybox.close();
}
You then don't need a separate close_fancy
function at all.
As per normal with jQuery, this code should be placed in a javascript block at the foot of your page, or inside a $(document).ready()
function.
Upvotes: 0