how to get label value in javascript?

Today, We want to share with you how to get label value in javascript.In this post we will show you set labels value in javascript, hear for How to Assign or Set Value Dynamically to a Label using JavaScript? we will give you demo and example for implement.In this post, we will learn about jQuery calculate sum of values in all text fields with an example.

how to get/set labels for attribute value in javascript

Example 1:

//js code
labelText = $("#productCode").text()

//HTML code

Using JavaScript innerHTML Property


Example 2: need to use .innerText
Using JavaScript innerText property

document.getElementById('*productCode').textContent

//HTML Code

Track label Property

Example 3:

var x = document.getElementById("productCode").label;

//OR Set

document.getElementById("productCode").label = "P9825650008";

I hope you get an idea about Label value to javascript variable.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment