javascript - Pull value from <li> in to <textarea> when <li> is clicked -


i have textarea inside form needs populate text inside li tag user clicks.

for example:

<ul id="selections">     // row1 <li>here text</li>     // row 2 <li>here more text</li>     // row 3 <li>here more text</li> </ul> 

when user clicks row 1, need text pop in textarea. when user clicks row 2 now, need row 2 pop in textarea, undernieth row 1.

any ideas on how this?

try:

$('#selections li').click(function() {   $('#id-of-your-textarea').append($(this).text() + '\n'); }) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -