samedi 23 juillet 2016

jquery change button state on click

I am working on Yii2 application and there is one submit button , like bellow

<button id="next" class="btn btn-primary btn-submit " data-loading-text="Please wait, processing..." value="1" name="next" type="submit">

when i click on button , this button become disable and chnage text as bellow

<button id="next" class="btn btn-primary btn-submit disabled" data-loading-text="Please wait, processing..." value="1" name="next" type="submit" disabled="disabled">Please wait, processing...</button>

now i have added one text filed with required attributes as bellow

<input id="name" class="form-control" type="text"maxlength="255" required="required"  title="">

my issue is when i click on submit button & text filed is empty, it show me that filed required but same time button goes disable.

how to make back this button enable and original state , if text field is empty ?

Thanks

Aucun commentaire:

Enregistrer un commentaire