javascript - How can I change a label text without interfering with an input radio inside the label? -


in html template i've got label input radio inside:

<label id="myid" class="inline">     <input type="radio" value ="11">      text </label> 

i need change text of label jquery. tried this:

$('#myid').html('my new text'); 

or

$('#myid').text('my new text'); 

but when loose input radio. how can preserve input radio inside label , modify label's text?

try this:

$('#myid').contents().last().replacewith('my new text'); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -