jquery - edit text of custom <ul> array -


i new jquery , have question updating data within page.

i have unordered list allow user manipulate. while ul starts 1 list item, allow user add objects array. have goal have user click object ul, pulls read textarea, , textarea allow user input custom string , have targeted list item's (text()) become custom string.

now, i'm not confused how pull .text(), , pretty sure can put custom string user creates chosen list item's text attribute...

the problem i'm having example:

the page starts out 1 single (blank) object in array. click "add object" , original array changed hold 2 objects or 3, etc. objects added array not "appearing" jquery script. first object transfer text textarea when clicked. same goes if initialize array with, 3 objects... 3 active.

i can show snippets of code if help. or if have questions, please ask , we'll go there, thanks.

my testing url: http://whoneedsstandards.com/subdomains/travis/jquery.htm ... maybe can follow step-by-step?

code:

//add list items//     $('a#add').click(function () {         $('<li id="' + + '">blank object</li>' + + '').appendto('#ul1');         i++;         $('#ul1>li:even').addclass('alert');         $('#ul1').load();     }); //click list item store in textarea//     $('#ul1>li').click(function () {         var temptext = ($(this).text());         $('textarea#text1').text(temptext);      }); 

use .live method register click handler.

var lastclickedli;  $("#ul1 > li").live("click", function() {     lastclickedli = $(this); }); 

see fiddle more complete example.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -