I want to get image src attribute using next(). My ul in which i have this image is dynamic so I am passing my ul id to my function. following is my code which is returning me undefined valued.
var nxtimg=$("#"+slideid+" li#2 img").next().attr("src");
above line works well if I remove .attr(“src”). also #2 is my li id from which I want next element but this becomes hard coded so i want to make it dynamic like,
var nxtimg=$("#"+slideid+" li"+liid).next().attr("src");
but when I add liid then it doesn’t work.
It look like you just need this:
Note that a number id is only valid in HTML5 doc. not in HTML4-