Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  111] [ 1]  / answers: 1 / hits: 42685  / 11 Years ago, tue, september 10, 2013, 12:00:00

jsFiddle here.



I'm a novice at Javascript and having trouble following the documentation at the iCheck page. I've followed the answer to what appears to be a very relevant StackOverflow question here but cannot get an alert to pop up displaying the value I've selected. Can anyone point me in the right direction, please?



HTML



<p>Are you sure you want to have your details removed from our marketing list?</p>
<div id=unsubscribe_radio>
<ul>
<li>
<input type=radio name=iCheck value=yes>
<label>Yes</label>
</li>
<li>
<input type=radio name=iCheck value=no>
<label>No</label>
</li>
</ul>
</div>


Javascript



$(document).ready(function () {
$('input').iCheck({
radioClass: 'iradio_flat-orange'
});
$(input:radio[name=iCheck]).click(function () {
var value = $(this).val();
alert(You clicked + value);
});
});

More From » jquery

 Answers
3

You must use iCheck like this



$(document).ready(function () {
$('input[name=iCheck]').on('ifClicked', function (event) {
alert(You clicked + this.value);
});
$('input').iCheck({
radioClass: 'iradio_flat-orange'
});
});


DEMO



Documentation


[#75790] Monday, September 9, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tiffany

Total Points: 46
Total Questions: 97
Total Answers: 84

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
;