开发者

how to append text to checkboxlist item text?

开发者 https://www.devze.com 2023-04-12 06:14 出处:网络
i would like to change the text in my checkboxlist text by appending a text \"new\". So the new checkboxes are \"onenew\" and \"twonew\"?

i would like to change the text in my checkboxlist text by appending a text "new". So the new checkboxes are "onenew" and "twonew"?

 var resultaat = $(开发者_如何学编程"label[for^=CheckBoxList1]").get().split();

            $.each(resultaat, function () {
//how to append 'new' to the values?
            });

 <asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem>one</asp:ListItem>
            <asp:ListItem>two</asp:ListItem>
        </asp:CheckBoxList>


Use the following line instead of var resultaat ... });.

$("label[for^=CheckBoxList1]").each(function(){
    $(this).text( $(this).text() + "new" );
});

Or (as an alternative method):

$("label[for^=CheckBoxList1]").text(function(i, text){
    return text + "new";
});
0

精彩评论

暂无评论...
验证码 换一张
取 消