js – IE11 only: Unable to get property ‘options’ of undefined or null reference

Home Forums Scripting General Scripting js – IE11 only: Unable to get property ‘options’ of undefined or null reference

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    alex100
    Member
    #167003

    New to this forum and hopefully someone can help. The following script works in all other browsers, except ie11, which is the one it has to work in.
    Referencing this line:
    var lable=event.target.options[event.target.selectedIndex].parentNode.label;[/CODE]
    vanilla js only, no jquery. Here is sample html and javascript. If anyone can help so it works in ie11, would appreciate [CODE]
    function run(event) { console.log(document.getElementById(“user”).label); var lable=event.target.options[event.target.selectedIndex].parentNode.label; if(lable == ‘user’){ document.getElementById(“copy”).value = “user”; } else if (lable == ‘warehouse’) { document.getElementById(“copy”).value = “warehouse”; } else if (lable == ‘dollhouse’) { document.getElementById(“copy”).value = “dollhouse”; } } [/CODE]

    [HTML]

    [/HTML][CODE] var lable=event.target.options[event.target.selectedIndex].parentNode.label;[/CODE]
    vanilla js only, no jquery. Here is sample html and javascript. If anyone can help so it works in ie11, would appreciate
    function run(event) { console.log(document.getElementById(“user”).label); var lable=event.target.options[event.target.selectedIndex].parentNode.label; if(lable == ‘user’){ document.getElementById(“copy”).value = “user”; } else if (lable == ‘warehouse’) { document.getElementById(“copy”).value = “warehouse”; } else if (lable == ‘dollhouse’) { document.getElementById(“copy”).value = “dollhouse”; } } [/CODE]

    [HTML]

    [/HTML][CODE]
    function run(event) { console.log(document.getElementById(“user”).label); var lable=event.target.options[event.target.selectedIndex].parentNode.label; if(lable == ‘user’){ document.getElementById(“copy”).value = “user”; } else if (lable == ‘warehouse’) { document.getElementById(“copy”).value = “warehouse”; } else if (lable == ‘dollhouse’) { document.getElementById(“copy”).value = “dollhouse”; } } [/CODE]

    [HTML]

    [/HTML]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.