简体   繁体   English

如何使用jquery编辑无序列表项

[英]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? 如何使用jquery编辑ul内部li的innerText属性?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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