javascript - trying to submit form with submit button as button -


i trying submit form , not working , want submit button disabled once clicked.

<form action="buy" method="post" >   <input type="hidden" name="tid" value="${tid}"/>   <td align="center" valign="middle">       <button onclick="this.disabled = true; document.getelementbyid('up7913').disabled = false;" type="submit"  name="down7913" id="down7913">subscribe now</button></td> </form> 

bind submit event , disable button.

document.getelementbyid('form').addeventlistener('submit', function(event) {     event.preventdefault();      this.down7913.disabled = true;      // handle post request }); 

demo: http://jsfiddle.net/jefvw66q/1/


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -