javascript - Change form submit button text after submition -


how change submit button text after submit?? have form button . change button text click next after submit form.

         <form>             <div class="form-group">                <div class="rightbox"> <label for='phone'>phone</label></div>                <div class="leftbox">                 <div class="col-sm-12">                     <input class="text-box single-line" data-val="true" name="phone" type="tel" value="" />                                         </div></div>                 </div>                                 <div class="form-group">                <div class="rightbox"> <label for='phone'>mobile</label></div>                <div class="leftbox">                 <div class="col-sm-12">                     <input class="text-box single-line" data-val="true" name="phone" type="tel" value="" required />                 </div></div>                 </div>                                    <div class="form-group">                 <div class="col-sm-offset-3 col-sm-9">                 <div class="btnok">                 <br/>                     <button type="submit" class="btn-primary" >                       click                     </button>                      </div>                 </div>             </div>      </form> 

$("#save").on('click',function(){    var $btnelm = $(this);    $("form").submit(function() {        return $btnelm.text('next');     });    })
   <button type="submit" class="btn-primary" id="save" >

i think how can change.

else want more specific after form submitted can go ajax method submit form , change text of button next after submitting form

$("#save").on('click',function(){      var $btnelm = $(this);      $("form").submit(function() {        $.ajax({           url: $(this).attr('action'),           method: "post",           data : $(this).serialize(),           success : function (data){                        $btnelm.text('next');                     }        });               });    });


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -