TWIRED

How-To Change Label Names in a Form [Solution]

1 post in this topic

Just wanted to share this. Hope it helps somebody.

 

solution to change the value of a label of a particular element in a form (Javascript):

------------------------------------------------------------------------------------------------------------

var labels = document.getElementsByTagName('label');

// 'label' is passed as the argument. To get this argument, First inspect the form element TYPE name in Chrome.

 

for (var i = 0; i < labels.length; i++) {

   if (labels.htmlFor != '') {

        var elem = document.getElementById(labels.htmlFor);

        if (elem)

           elem.label = labels;         

   }

}


document.getElementById('EditRecordDummyCount').label.innerHTML = 'Label text is changed';

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now