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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -