Change the content of specific label - Javascript jQuery

Javascript examples for jQuery:Form Input

Description

Change the content of specific label

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
$(function() {/*  w ww .ja v a  2 s . com*/
  modifyLabelText();
});
function modifyLabelText() {
  $('label[for="my"]').text('My new Content');
}

      </script> 
 </head> 
 <body> 
  <label for="my"> Make a choice: <em>*</em> </label>  
 </body>
</html>

Related Tutorials