javascript - Jquery avoid normal buttons when selecting :submit -


say have following html document:

<form class="" ng-submit="ctrl.submit(ctrl.academy)" submit-throbber> <div class="modal-body">     <div class="row">         <div class="col-xs-12 b-r" style="margin-top: 10px;">             <div class="form-group">                 <label translate="forms.name"></label>                 <input class="form-control" placeholder="{{ 'forms.name_placeholder' | translate }}"                        ng-model="ctrl.academy.name" required="">             </div>             <label translate="forms.description"></label>             <textarea class="form-control" placeholder="{{ 'forms.description_placeholder' | translate }}"                       ng-model="ctrl.academy.description"                       style="height: 300px; margin-top: 0px; margin-bottom: 0px;"></textarea>         </div>     </div> </div> <div class="lb-modal-footer">     <button class="btn btn-default" tooltip="{{ 'tooltip.cancel' | translate }}" ng-click="ctrl.cancel()"><i             class="fa fa-ban"></i></button>     <button type="submit" class="btn btn-success m-l-xs" tooltip="{{ 'tooltip.save_and_exit' | translate }}"><i             class="fa fa-check-square-o"></i></button> </div> 

now when use jquery find submit button do: $('form').find(':submit')

however in above case finds 2 results (both of buttons)

this works correctly according documentation

however there way avoid this?

try $('form').find('[type=submit]')


Comments