lundi 27 juin 2016

Unable to fire javascript event OnClick of checkbox

So I have a checkbox control that I cannot get to fire OnClick. I've tried a number of different ways: Binding the event onload; adding the event as a parameter in the tag

Here is my most recent iteration of code. I'm trying to fire an "Alert" just to confirm that it changed.

<section class="border-bottom">
         <div id="approx" class="content">
          <h3>This is my approximate location</h3>
          <div class="form-control-group">
           <div class="form-control form-control-toggle" data-on-label="yes" data-off-label="no">
               <input type="checkbox"  />
           </div>
          </div>

         </div>
    </section>

$('input[type="checkbox"]').bind('click', function(){
    alert("OK");
    })

I also wouldn't mind being able to run it via the input

<input type="checkbox" onclick="runMyFunction(); return false;" />




Aucun commentaire:

Enregistrer un commentaire