jQuery .live function problem -
i have element gets attribute added jquery when page loads. attribute called jcarouselindex. need value of attribute when document loads.
ive got selector , if wasn't added dynamically do:
id = jquery('#gallery-carousel li.selected').attr("jcarouselindex");
but since been added dynamically value of id undefined. think need use .live() know how value of attribute please?
your code above should work. .live() used different purpose. think may trying access attr before being dynamically added. try calling function using settimeout, ensure existing code gets executed.
settimeout(function(){ id = jquery('#gallery-carousel li.selected').attr("jcarouselindex"); }, 0);
i'm assuming code within $(function(){}); block.
Comments
Post a Comment