This simple JS can't set the value of "para". I guess getElementByName doesn't work. But why?
<script>
function fn()
{
document.getElementById("para").setAttribute("name","hi");
document.getElementByName("hi").setAttribute("value","my value is high");
}
</script>
HTML:
<input type="button" onClick="fn()" value="click me">
<input id="para" type="text" />
![Chrome extension - detect if button on the webpage is clicked [duplicate]](https://file.115kc.com/storage/eg/image213.jpg)