Search code examples
javascripthtmljqbootstrapvalidation

Is there a way to disable javascript for just a part of my HTML code?


I'm using a bootstrap template which use "jqBootstrapValidation.js" (http://reactiveraven.github.io/jqBootstrapValidation) to validate it's forms. I edit template and add a form to it, but my submit button doesn't work!when I comment the script which inculde "jqBootstrapValidation.js", my submit button get to work! I don't want to edit the Javascript file. Is there a way to disable it for just my form?

this is my form:

<form name="register" id="regForm" name="input" action="pay.php" method="post">
        <div class="row control-group">
            <div class="form-group col-xs-12 floating-label-form-group controls">
                     <label> email</label>
                     <input type="email" class="form-control" 
                         id="email" required>
                     <p class="help-block text-danger"></p>
             </div>
        </div>

        <div class="row control-group">
              <div class="form-group col-xs-12 floating-label-form-group controls">
                     <label>Telephone</label>
                     <input type="tel" class="form-control"  id="phone" required>
                     <p class="help-block text-danger"></p>
              </div>
        </div>

        <div id="success"></div>

        <div class="row" align="left">
               <div class="form-group col-xs-12">               
                    <button type="submit" class="btn btn-success btn-lg">
                      register
                    </button>
               </div>
         </div>
 </form>

Solution

  • If the special form is on a single page, you can remove that big script link. Alternatively, you can use jQuery to load the JS file dynamically.

    if(!$("#myformid")){
        $.getScript("ajax/test.js");
    }