I cant figure out how you detect the user changing a ratchet toggle element in javascript. In the code below I have got it to detect clicking on the toggle but it doesn't work if the user slides the toggle. Is there a standard correct way of detecting toggle state change? (A documentation link would be fine here - I couldn't find anything).
(BTW, I am currently just running in the firefox browser to evaluate Ratchet, before I add to a Cordova project.)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ratchet template page</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<link href="/My_Webs/experiments/cordova/ratchet-example/css/ratchet.css" rel="stylesheet">
<link href="/My_Webs/experiments/cordova/ratchet-example/css/ratchet-theme-ios.css" rel="stylesheet">
<script src="/My_Webs/experiments/cordova/ratchet-example/js/ratchet.js"></script>
<script src="/My_Webs/experiments/cordova/ratchet-example/js/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function(){
$("body").on(
"click",
"#toggle1",
function(e){
console.log("toggle1 clicked " + $("#toggle1 .toggle").hasClass("active"));
});
});
</script>
</head>
<body>
<div class="content">
<ul class="table-view">
<li class="table-view-cell" id="toggle1">
Item 1
<div class="toggle">
<div class="toggle-handle"></div>
</div>
</li>
</li>
</ul>
</div>
</body>
This works...