javascript - Get element from inside function -
good morning in timezone.
i had code in html page
<span id="x> <div onclick="$(this).applyfancybox({ trigger: !$.browser.msie, target: (event.srcelement || event.target) }); return false;">
and changing code
<span id="x"> <div> </span> <script> ... $(document).ready (function () { $("#x div") .click(function(){ this.applyfancybox({ trigger: !$.browser.msie, target: (event.srcelement || event.target) }); return false; }); } ... </script>
this not working because think not pointing div element, how can fix ?
thanks in advance best regards
try changing this
$(this)
this
javascript object , $(this)
jquery object
so final code like
$(document).ready (function () { $("#x div") .click(function(){ $(this).applyfancybox({ trigger: !$.browser.msie, target: (event.srcelement || event.target) }); return false; }); }
by way , $.browser.msie
deprecated 1.3 , removed in 1.9
Comments
Post a Comment