JavaScript and JQuery Accessing HTML Elements -
i have html file in import jquery own javascript file. when put:
<script> $( "#htmlid" ).click(function() { $( "#htmlid" ).hide(); }); </script>
in html file , click on "htmlid" div in question, hides it. however, when put:
$( "#htmlid" ).click(function() { $( "#htmlid" ).hide(); });
in javascript file, doesn't work. why this?
try wrap following:
$(document).ready(function(){ $( "#htmlid" ).click(function() { $( "#htmlid" ).hide(); }); });
Comments
Post a Comment