I see examples for all of this, but for some reason mine is not working. I have a text box that is added dynamically if a specific value is selected in the selected list.
The part where the field is displayed works, but I'm also trying to add text to the field that I cannot get. I am also trying to use JS to select text after typing it - but have not received it yet!
Is there anything wrong with this?
function showBox() {
if (document.getElementById("ctl00_Content_WhereFound").value == "Other" || document.getElementById("ctl00_Content_WhereFound").value == "Friend/Employee Referral")
{
document.getElementById('ctl00_Content_WhereDetails').style.display = "inline";
if (document.getElementById("ctl00_Content_WhereFound").value == "Other") {
document.getElementById('ctl00_Content_WhereDetails').innerHTML += 'Enter Other';
} else {
document.getElementById('ctl00_Content_WhereDetails').innerText += "Enter Referral";
}
}
}
tpow source
share