jquery, div with table is not visible when I call show();
<div id="abclink">
+ click here to view
</div>
<div id="abctable" style="display: none;">
some text here, allot of text
</div>
So using jquery I try and do:
$开发者_如何学JAVA("#abclink").bind("click", function() {
$("#abctable").show();
});
This doesn't work, and I don't know why?
you have to put a #
$("#abclink").bind("click", function() {
$("#abctable").show();
});
You might be missing the document.ready function. Also, it might be best to use toggle instead of show:
$(document).ready(function(){
$("#abclink").bind("click", function() {
$("#abctable").toggle();
});
})
I'm guessing #abclink doesn't exist at the point you're trying to bind the event. Are you doing it in the of the page? If so, try putting it in the document.ready event:
$(function() {
[your code]
});
精彩评论