简体   繁体   中英

How do you use jquery to edit unordered list items

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>";
            }
        });

Something along these lines:

$(document).ready(function() {
    $("#SuperTextbox1_Results").children('li').each(function(){
        $(this).text('blah');
    });
});

How about

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

Or, if you want the label:

$('#SuperTextBox1_Results li').html('<label>whatever you want</label');

这样的东西?

 $('#SuperTextBox1_Results li').each(function(){$(this).text('whatever');})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM