Reputation: 8274
Form Field:
<div class="form-group">In-Store Exclusive.
<div class="make-switch pull-right">
<input type="checkbox" id="radstuff" <%if (offer.get('inStoreOnly')) {%>checked<%}%> disabled>
</div>
</div>
Which outputs as:
I am really trying to do something after the 'On or Off' state is toggled. Default is OFF, OK; but I want to hit 'ON' and do something. Say trigger a link opening. I cannot figure out how to access this.
coolfunction: function() {
if offer.get('#radstuff').is('.switch-on');
{
window.open("http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images[0]=YOUR_IMAGE_TO_SHARE_OBJECT.com",'_blank');
},
Update: Most Recent Attempt.
coolfunction: function ()
offer.get('#radstuff').parent().is('.switch-on') {
/* return true; */
alert('Test');
},
After clicking 'OFF' as the above output referenced; NADA.
Upvotes: 0
Views: 967
Reputation: 35864
Assuming you're using this widget, you're not accessing the correct markup to find .switch-on
.
The markup that is created looks kind of like:
<div class='make-switch has-switch' >
<div class='switch-on switch-animate'>
<input type='checkbox' checked />
....
</div>
</div>
You're code is expecting the input[checkbox]
element to get the .switch-on / .switch-off
classes, but it is a div one level higher. So maybe something like:
offer.get('#radstuff').parent().is('.switch-on')
Upvotes: 1