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";
});
精彩评论