jQuery on('toggle') possible?

Viewed 23451

Instead of using $('.element').toggle(function(){}, function(){});

I would need to use the .on() method on the element I want to use .toggle() on but I can't figure out how to specify my second event handler function:

$('body').on('toggle', '.element', function(){});

Where would I have to specify the second handler function for my toggle event?

I did this here: http://jsfiddle.net/D33f4/ but nothing happens on the first click. I really don't understand why.

2 Answers

This worked for me.

  $("#chkShowDevices").click(function() {
    console.log($("#chkShowDevices").prop("checked"));
  });
Related