It's is a bug. I copy&paste you code, and I see an alert "123".
You can simple try it, buy paste this code in FireBug console in any website that support jQuery (like jQuery.com) On Jan 23, 5:14 pm, nk <neetuk...@gmail.com> wrote: > Hi Ami, > > Thanks for your response. > I am still not getting the value. > > Please let me know what is wrong with the following code.I am getting > a blank alert message at the beginning. > <script type="text/javascript"> > $(document.body).prepend("<ul id=theUl><li id=1>abc</li><li > id=2>def</li><li id=3>ghi</li></ul>"); > var result=''; > $.each ( $("#theUl").children(), > function () {result+=($(this).attr('id'))} > ); > alert(result); > </script> > the body tag has the following > <fieldset> > <legend>Collapsible List — Take 3</legend> > <!--- > <ul id=theUl> > <li id=1>abc</li><li id=2>def</ > li><li id=3>ghi</li></ul> > </fieldset> > > NK > > On Jan 22, 8:45 pm, Ami <aminad...@gmail.com> wrote: > > > My javascript syntax is better than my English syntax, So i hope that > > you can understand it > > > $(document.body).prepend("<ul id=theUl><li id=1>abc</li><li id=2>def</ > > li><li id=3>ghi</li></ul>"); > > var result=''; > > $.each ( $("#theUl").children(), > > function () {result+=($(this).attr('id'))} > > ); > > alert(result); > > > Good luck, > > Ami > > > On Jan 23, 12:38 am, nk <neetuk...@gmail.com> wrote: > > > > Hi All, > > > > I have a list which is being populated dynamically from the database.I > > > am trying to capture the value of the list items (using click > > > function) and pass it to a query to get the result set.The value > > > attribute has been deprecated for LI.Please tell me a way to capture > > > the LI value. > > > > <ul id="developerul"> > > > <li value='1'>One</li> > > > <li value='2'>Two</li> > > > <li value='3'>three</li> > > > </ul> > > > For the above I have tried > > > $("#developerul".children()) > > > and also $(this).children() > > > But does not work. > > > > ------------------------------------- > > > And also how can we concatenate a ID value > > > ID="thelistItems" > > > the result should be "thelistItems_11130". > > > > $("#thelistItems+ _ + 11130").append(txt); > > > > Thanks