Hi, I have these codes and it's works well. But the problem is the button disabled ONLY when the input is filled. I would like that the button should be disabled on loading page if the a word is inside of input. Then if nothing is inside on loading page should still disabled. Thank you!
JavaScript
function manage(txt)
{
var bt = document.getElementById('btSubmit');
if (txt.value != '')
{
bt.disabled = false;
}
else
{
bt.disabled = true;
}
}
Amit MohantyRank #112 · 20K reputationPosted Dec 29, 2022, 7:44 AM EST
Check this
function manage() { var txt = document.getElementById('txt'); var bt = document.getElementById('btSubmit'); if (txt.value != '') { bt.disabled = false; } else { bt.disabled = true; } }IsraelRank #1,223 · 1.5K reputationPosted Dec 29, 2022, 4:00 PM EST
Amit Mohanty
Perfect, perfect, perfect.
Thanx.
Aravind GovindarajRank #430 · 5.8K reputationPosted Dec 29, 2022, 6:23 AM EST
you have to call this method on onload event.
IsraelRank #1,223 · 1.5K reputationPosted Dec 29, 2022, 7:16 AM EST
See what I am trying to do. But onloading page its still disabled even i put value="xxx". I need it disabled ONLY when the input text is filled..