mardi 18 octobre 2016

Conflict between jquery and JS script (google maps and checkbox)

How can I avoid the conflict between JQuery and js?

this one is used to display the google maps

<script type="text/javascript" src="assets/js/jquery-1.12.4.min.js"></script>

The other one is used to enable/disable the form send button by a checkbox (the privacy policy)

  <script type='text/javascript' src='http://ift.tt/RGmpTw'></script> 


    <script> 
     $(window).load(function(){
      $('#postme').attr("disabled","disabled");
       $('#checky').click(function(){
          if($(this).attr('checked') == true){
              $('#postme').removeAttr('disabled');
      }else {
    $('#postme').attr("disabled","disabled");   

      }
   });
 });

</script>   

HTML:

       <p><input type="checkbox" id="checky" name="check" /><a href="privacy.php" title="privacy"><small>privacy</small></a></p>                    
        <input type="submit" value="Send" name="send" id="postme" class="btn btn-primary btn-lg" data-loading-text="Loading...">

              </div>

If I enable a js does not work the other and vice versa. I tried to put the js and the script at the bottom of the page and inside the header, but no works.

What does it means "not works"?

With jquery-1.5.2.js, google map is not loaded. There is a white space into the div box (and the checkbox button is working).

With jquery-1.12.4.min.js, google maps is loaded, but is it not possible to enable/disable the form send button. It remains disabled.

How can i solve the conflict?

Thanks




Aucun commentaire:

Enregistrer un commentaire