Why document.getElementById(“something”).value not working for <Select> with
The document.getElementById("something").value in my controller on HTML tag is not working after Locker Service is enabled. I did console.log() and it's returning nothing.
Any idea how to overcome this issue? Any idea why document.getelementbyid not working?
Help is very much appreciated.
HTML markup :
<select class="form-control picklist" onchange="{!c.filteredProducts}" name="Discount__c" id="discount"> </select>
And the javascript function:
filteredProducts: function(component,event,helper) { var discount =document.getElementById("discount").value; }
The reason behind document.getelementbyid not working is :
JavaScript document. getElementByID is not a function Solution. The JavaScript getElementById method selects an element from the HTML Document Object Model (DOM). If you incorrectly spell this method, you'll encounter the document.
You can do something like this it's may help you:
Volvo Saab Opel Audi function changeVal(){ console.log(':::',document.getElementById("SelectId").value); }