简体   繁体   中英

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 "hello":
code...
break;
}
$("#lbl").text('hello');

See .text()

If the label is inside a naming container, then you can use

$("#<%= lbl.ClientID %>").text("hello");
$("span[id*='lbl']").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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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