jquery click() problem, how to?
i have this setup:
<script type="text/javascript">
$(document).ready(function() {
$("#click_me_link").click(function () {
$("#link_more").show("slow");
});
});
</script>
<div id="click_me_link"><img src="/images/banner_bottom.png"></div>
<div id="link_more" style="width: 530px开发者_如何学C; height: 66px; display: none;">
test
</div>
if i click on the click_me_link
it wont display the hidden div. if i run $("#link_more").show("slow");
in the console it works
any idea? thanks semicolon fixed, still doesn't work
Yeah the issue is your css in link_more. You are missing a semicolon. It needs to be this:
width: 530px; height: 66px; display: none;
Anyway, you probably want to make click_me_link an anchor instead of a div and use e.preventDefault() inside your click event.
It's working here http://jsfiddle.net/imoda/eXPW5/
You're missing a ;
after the height property
<div id="link_more" style="width: 530px; height: 66px display: none;">
Not sure if that's causing your problem as I can't seem to replicate it, but it's no doubt something to fix.
You were missing a semi-colon after "66px". Other than that, your example is working for me.
Here is a working jsfiddle: http://jsfiddle.net/Mm9AQ/
精彩评论