I am trying to get onclick/onfocus/onchange in an HTML tag that is being created by Jira. The item itself is a drop down list and while I can get onfocus to work on other IDs, I cant get it to work on the drop down list
What I have:
<script type ="text/javascript" >
console.log("Testing");
var colorDropDown = document.getElementById('someID');
function changeColor()
{
//if(value)
alert("Hello World");
}
document.getElementById("someID").innerHTML ="<onfocus=\"changeColor()\"></select>"
//document.getElementById("customfield_11901").innerHTML = "<select class=\"select cf-select\" name=\"customfield_11901\" id=\"customfield_11901\" onfocus=\"changeColor()\">"
</script>
After using innerHTML, the onfocus does not appear in the page. I have also tried this by copying the entire tag and inputting it via HTML.
I have used the .onchange function after getElementById, but that does not work either.
<onfocus>isn't a thing.<onfocus=\"changeColor()\"></select>isn't valid HTML. Do you mean<select onfocus=\"changeColor()\"></select>?