I have this bit of code.
What I want is when I click on .delbutton #slide will hide.
$(document).ready(function() {
var slide = $('#slide')
$('.link').click(function() {
slide.animate({'bottom' : '0px'}, 500).append('<div class="delbutton"></div>')
});
});
$(document).ready(function(){
$('.delbutton').click(function() {
$('#slide').hide()
})
})
Cant figure out what is wrong with it. Just not working.
Thanks for your help
Your click function is not being applied to anything because the DIV you are adding it to doesn’t exist at the time it is applied. You need to use the live handler, which will work for a click handler, though not for all types of events.