I can't see the listbox items in page source
Im adding items to listbox by using jquery but when i look to the page source(html source) ,the items that I've added dont seen.Im adding items by this way
$("#<%=ListBox2.ClientID%>").append("<option value="+exampleValue+"开发者_如何转开发>"+exampleName+"</option>");
You need quotes on attributes, like this:
$('#<%=ListBox2.ClientID%>')
.append('<option value="' + exampleValue + '">' + exampleName + '</option>');
Also, depending on the browser, it will show the original page's source when you do "View Source"
As an aside: there is a faster approach if adding many elements, since jQuery will cache the fragment:
$('#<%=ListBox2.ClientID%>')
.append($("<option></option>").attr("value",exampleValue).text(exampleName));
精彩评论