javascript - can I pass dynamic id to document.getElementById(""); -
i have 2 id li element
listitem1
listitem2
in javascript can pass these 2 id dynamically  document.getelementbyid("");
getelementbyid() method other, , therefore might provide variable containing string argument.
var identifier = "listitem1"; document.getelementbyid(identifier);   but might consider using classes instead of ids if want address multiple instances...
Comments
Post a Comment