javascript - Trying to enable a disabled button when a textfield is not empty -
so im trying enable button when 3 text fields not empty,and disable button again if become empty.right trying 1 field working first cant work , no idea why.would appreciate help
<head> <script type="text/javascript"> function checkenablesubmit() { if ( completepurchaseform.address.value != "") {document.getelementbyid("button").disabled = false;} } </script> <form action="regservlet" name="completepurchaseform" method="post"> <table> <tr> <td> address : </td><td> <input name="address" onkeyup="checkenablesubmit()" id="address" size=100 type="text" /> </td> </tr> <tr> <td> card type : </td><td> <input name="cardtype" id="cardtype" size=15 type="text" /> </td> </tr> <tr> <td> card number : </td><td> <input name="cardnumber" id="cardnumber" size=15 type="text" /> </td> </tr> </table> <input type="hidden" name="action" value="completepurchase" /> <input type="button" disabled name="submit" value="complete purchase" /> </form>
add id button <input type="button" id="button1">
use document.getelementbyid("button1")
Comments
Post a Comment