i have a fairly simple dropdown I build. Here is the live example: http://jsfiddle.net/K8VtB/
The code i’m using is this:
$(document.body).delegate('.select .option', 'click' , function(e){
e.stopPropagation();
$(".select .option:not('.darr')").hide();
selectedOption = $(this).parents("div.select").find(".option:first");
$(this).siblings().show();
selectedOption.text($(this).text()).attr("title",this.title);
});
$(document.body).delegate('.select .option:not(".darr")', 'click' , function(e){
$(this).parents("div.select").find(".option:not('.darr')").hide();
console.log($(this).attr('data-ajax-link'));
});
$(document).click(function() {
$(".select .option:not('.darr')").hide();
});
I got some help with this because I’ve never used delegate before.
I tried doing the same with the live() method. I wonder why this is just not working with live? Or what I’m doing wrong?
Here is the same script with live I tried to do. Just nothing works. http://jsfiddle.net/K8VtB/1/
Can anyone help me out here and tell me what I’m doing wrong when using live() ?
change
to
here is the fiddle http://jsfiddle.net/K8VtB/4/