I want to get an element using id:
var a = document.getElementById("hello");
and then dynamically add an attribute to it called "labelText" and assign the value "{labeltext}" to it.
do i need to use concatenation?
i tried the following but it didn't work:
document.getElementById("hello").setAttribute("labelText", "'{' + labelText + '}' ");
"string" + variable + "string"=>"{" + labelText + "}"setAttributeis the correct way of setting an attribute on a DOM element. You need to elaborate on "it didn't work".