Form Code:
<form role="form" id="payment-form" onsubmit="return validate(this);"> <div class="row"> <div class="col-xs-12"> <div class="form-group"> <label>Номер</label> <div class="input-group"> <input type="text" class="form-control" name="Number" placeholder="Номер" required /> <span class="input-group-addon"> </div> </div> </div> </div> <div class="row"> <div class="col-xs-12"> <button class="btn btn-primary" id="bbankCard" type="button">Принять</button>
However, you cannot change the <button>
to <input>
. As the data that I enter in the form field, send to the JS handler and check for a match with var number = new RegExp("/^\d{12,18}$/");
using the test()
method.