problem in reading textbox value in li
Posted
by user269431
on Stack Overflow
See other posts from Stack Overflow
or by user269431
Published on 2010-02-16T11:29:43Z
Indexed on
2010/05/05
3:08 UTC
Read the original article
Hit count: 213
jquery-ui
I have a ul as follows: It can`t read the text values neither with val() nor text(). Can anyone help please
<ul id="mylist">
<li id="1"><input type = "text" value= "aaaaa" /></li>
<li id="2"><input type = "text" value= "bbbb" /></li>
<li id="3"><input type = "text" value= "ccc" /></li>
<li id="5"><input type = "text" value= "dddd" /></li>
</ul><button id="Button1">Add Another2</button>
var values = [];
$(document).ready(function() {
$("#Button1").click(function() {
$( "#mylist li text").each(function() {
alert($(this).text());
values.push($(this).text());
});
});
});
© Stack Overflow or respective owner