Saturday, 28 September 2013

using a javascript variable to refer to an element with id containing the variable

using a javascript variable to refer to an element with id containing the
variable

HTML In my html I have an element with id ="check1"
<span id="check1"></span>
JAVASCRPIT I have a variable a='1', which is coming from somewhere else.
Now, I want the inner HTML of span element to be "correct" with the help
of reference to its id, and using 'a'.
var a = 1;
$.(#**checka**).innerHTML="correct"
How to write the id ??

No comments:

Post a Comment