jquery - how to show list items separately in output using javascript -


I have created a html that has the search box after searching, I'm getting the data in the list but when I click on it I am getting the value of all the list items using this

  var text = $ (this) .text (); Method   

In my app, if I click on an item, then I should only give the list item the value which is not other I'm making a mistake somewhere, but not me I know.
Here is my code:

HTML

  & lt; Ul data-role = "Listview" class = "ui-li-icon" & gt; & Lt; Li id = "list" & gt; & Lt; / li & gt; & Lt; / Ul & gt;   

And here is my javascript code:

  function success callback (feedback OBJ) {// warning (JSON.stringify (responseObj)); Form.reset (); Dataj = JSON.stringify (responseObj); Lane = dataj.length; (I = 0; i   

So when I'm searching for an item I'm getting a list of it:

  ab abc   

But when I clicked on it, I get the value of both ab and abc . I just want one value where I clicked.

/ P>

  $ ('.ui-li-icon li') . Click (function () {var index = $ (this) .index (); var text = $ (this) .text (); alert ('index is:' + index + 'and text' is text;) ;});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -