jQuery UI button - how change style and icon checked buttons?
jquery, jquery-ui
Solution
You could add a `.change()` handler that took the `.checked` state of the checkbox and assigned the icon based on it, like this:
$(".votePollState").button({
icons: {primary:'ui-icon-closethick'},
text: false
}).change(function() {
$(this).button("option", {
icons: { primary: this.checked ? 'ui-icon-check' : 'ui-icon-closethick' }
});
});
You can test it out here.
Problem
``` <script type="text/javascript"> jQuery(document).ready(function($){ $('.date').datepicker($.datepicker.regional['cs']); $(".votePollState").button({ icons: {primary:'ui-icon-closethick'},text: false }); }); </script> ``` HTML code: ``` <input type="checkbox" class="votePollState" id="point-1"/><label for="point-1">Choice 1</label> <input type="checkbox" class="votePollState" id="point-1"/><label for="point-1">Choice 1</label> ``` I need setting some icons for state of checkbox, no checked checkbox has other icon and checked checkbox has other. No if i check checkbox, this has some icon but only change border color. Something use ON/OF switch button on iPhone. THX