jquery change button state on click
<p>I am working on Yii2 application which has one submit button, as below</p>

<pre><code>&lt;button id="next" class="btn btn-primary btn-submit " data-loading-text="Please wait, processing..." value="1" name="next" type="submit"&gt;
</code></pre>

<p>When I click the button, it is disabled and the text changes, as below</p>

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

<p>Now I have added one text field with required attributes, as below</p>

<pre><code>&lt;input id="name" class="form-control" type="text"maxlength="255" required="required"  title=""&gt;
</code></pre>

<p>My issue is that when I click on the submit button when the text field is empty, it shows me that field is required but at he same time the button becomes disabled. </p>

<p>How do I return this button to its original enabled state if the text field is empty?</p>