I am experimenting with applying JavaScript to an element that is initially hidden using the display:none attribute. For example:
<input type="button" onclick="document.getElementById('container').style.display='block';">
<div style="display:none;" id="container">
<input type="text" name="somename" id="somename" onclick="applySomeJsToTextField();">
</div>
function applySomeJsToTextField() {
// Add JavaScript code here
}
Since the element is not accessible to the Document Object Model (DOM) when it loads within a display:none element, how can I work around this limitation?
Appreciate your help.