tags:

views:

264

answers:

3

How can I edit the innerText property of a li inside a ul using jquery?

I used this approach and wasn't able to get it working.

$(document).ready(function() {
            var lis = $("#SuperTextbox1_Results li").get();
            for (var i = 0; i < lis.length; i++) {
                lis[i].innerText = "<lable>added text!<label>";
            }
        });
+1  A: 

How about

$('#SuperTextBox1_Results li').text('whatever you want');

Or, if you want the label:

$('#SuperTextBox1_Results li').html('<label>whatever you want</label');
JorenB
+1  A: 

something like this?

 $('#SuperTextBox1_Results li').each(function(){$(this).text('whatever');})
krishna
+2  A: 

Something along these lines:

$(document).ready(function() {
    $("#SuperTextbox1_Results").children('li').each(function(){
        $(this).text('blah');
    });
});
matpol
How would I use this to concat instead of replace the li value?
Raúl Roa
$(this).append('blah');
krishna
What if the concat is at the beginning?
Raúl Roa
$(this).prepend('blah');
krishna