Reputation: 1096
$("#front").click(function () {
$(this).slideUp();
});
and
<div class="a" id="front">
<div class="b">
<h1>...</h1>
<p>..........</p>
</div>
</div>
Is there anything wrong with this code? Because it does not work properly.
Upvotes: 0
Views: 4562
Reputation: 9461
One thing that hasn't been mentioned is the callback function, it doesnt really apply here but for those of you who are having this issue and this doesnt solve it make sure you have nothing like a 'remove()' straight after. If you do, use:
$('#ele').slideUp(function(){
$(this).remove();
});
Like I say, just in case :)
Upvotes: 0
Reputation: 11175
What Chuck said.
$(document).ready(function() {
$("#front").click(function () {
$(this).slideUp();
});
});
You can't bind a click on a div that might not exist yet <3
Upvotes: 2
Reputation: 1148
$(document).ready(function() {
$("#front").click(function () {
$(this).slideUp();
});
});
Upvotes: 2