How to assign the text to the label using Jquery for the web controls
i am having and by using jquery ineed to assign another text "hello" to the label "lbl" through the jquery. and if we access the label "lbl" the text "hello" should come because the value "hai" is replaced with "hello" and if we write the below line i should get the new modified lable in aspx.cs file
my aspx.cs file code is
switch(lbl.Text)
{
case "hel开发者_JAVA技巧lo":
code...
break;
}
$("#lbl").text('hello');
See .text()
If the label is inside a naming container, then you can use
$("#<%= lbl.ClientID %>").text("hello");
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#lbl").text('Hello');
});
</script>
$("span[id*='lbl']").text("hello");
精彩评论