Hi guys,
I'm using iCheck to style radio buttons and checkboxes with CSS. An awesome plugin!
I have the following which works like a charm without iCheck:
- $('input[name=radio-group-1]:radio').change(function() {
- if ($(this).val() == 'no') {
- $('.btn[href="#page-04"]').attr("href","#page-06");
- } else {
- $('.btn[href="#page-06"]').attr("href","#page-04");
- }
- });
To replicate the above while using iCheck I must use one or more of iCheck's callback functions. I've started with the callback function 'ifChecked' and gave my inputs an ID for easy targeting and I'm able to change with the following the href from #page-04 to #page-06, but it changes already on page load.
- $(function(){
- if ($('#r2').on('ifChanged')) {
- $('.btn[href="#page-04"]').attr("href","#page-06");
- }
- });
And if i wrap it in the .change() function such as $('input[name=radio-group-1]:radio').change(function() - and add the 'else; statement as well, it doesn't do anything
If someone can spot where I go wrong or perhaps do I need to use a iCheck method or another callback function... I'm lost.
Thanks!
Ralph