Get tagname name value javascript
问题 I'm trying to get the tagname of name from the below line of code. I have to get the name from the below tagname using javascript <preference name="webviewbounce" value="false" /> i need to get webviewbounce This is what i know. document.getElementsByTagName("preference") But it doesnt give me the preference name . What i want is the tagname of name which is webviewbounce 回答1: Use document.querySelector to get the element. It will return the first matched element.Then use getAttribute to get