5
Reply

How to select html tag attribute using javascript?

Deepak Verma

Deepak Verma

10y
1.1k
0
Reply

    By I'd document. getElementById()

    i think answer is "var x = document.getElementById("mySelect");"

    document.getElementByTagName('Tag') e.g. document.getElementByTagName('div');

    if you want to select any html tag using javascript the below function is used document.getelementsbytagname("HtmlTag"); if you want to set any attribute for any html tag using javascript the below function is used document.getElementsByTagName("HtmlTag")[0].setAttribute("Property", "Value");

    I am not getting the question. did you mean to say "Select html tag based on attribute using Javascript"??