iCheck library: value of selected radio button

Clive van Hilten

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);
  });
 });
Anton

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

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Jquery for pass selected radio button value on button click

분류에서Dev

checking if a radio button is selected

분류에서Dev

How to get selected radio button value onclick from php

분류에서Dev

Get selected button's value from Polymer radio group with jquery

분류에서Dev

Add class to selected radio button

분류에서Dev

Add class to selected radio button

분류에서Dev

How to check radio button with radio button value

분류에서Dev

How to retrieve selected value of radio button from fetch array result..?

분류에서Dev

Radio button in WPF Application selected but not visible

분류에서Dev

jQuery After page loaded, check if radio button selected

분류에서Dev

jQuery - Do not run code again if radio button was already selected

분류에서Dev

Getting the combination of selected radio buttons to show message on button click

분류에서Dev

How to get the last selected radio button id in jQuery?

분류에서Dev

jQuery if condition for radio button name and value

분류에서Dev

javascript radio button return previous checked value

분류에서Dev

How to pass radio button value with php

분류에서Dev

Passing selected button value from view to controller

분류에서Dev

Hide submit button if selected option value is null

분류에서Dev

How to assign the variable value to radio button's value in php

분류에서Dev

Radio button clicked to slide & show hidden div & pass a value

분류에서Dev

How to check a Radio button from the value of a table of mySQL

분류에서Dev

Setting value on dynamic radio button with ng-repeat

분류에서Dev

Android Radio Button Animation

분류에서Dev

If radio button is checked not running

분류에서Dev

using radio button with knockoutjs

분류에서Dev

How to tick check-boxes on page load according to the value of radio button in jquery?

분류에서Dev

Java Radio button clear/deselect

분류에서Dev

PHP check if a radio button is clicked

분류에서Dev

Radio button for enumerize in rails admin

Related 관련 기사

  1. 1

    Jquery for pass selected radio button value on button click

  2. 2

    checking if a radio button is selected

  3. 3

    How to get selected radio button value onclick from php

  4. 4

    Get selected button's value from Polymer radio group with jquery

  5. 5

    Add class to selected radio button

  6. 6

    Add class to selected radio button

  7. 7

    How to check radio button with radio button value

  8. 8

    How to retrieve selected value of radio button from fetch array result..?

  9. 9

    Radio button in WPF Application selected but not visible

  10. 10

    jQuery After page loaded, check if radio button selected

  11. 11

    jQuery - Do not run code again if radio button was already selected

  12. 12

    Getting the combination of selected radio buttons to show message on button click

  13. 13

    How to get the last selected radio button id in jQuery?

  14. 14

    jQuery if condition for radio button name and value

  15. 15

    javascript radio button return previous checked value

  16. 16

    How to pass radio button value with php

  17. 17

    Passing selected button value from view to controller

  18. 18

    Hide submit button if selected option value is null

  19. 19

    How to assign the variable value to radio button's value in php

  20. 20

    Radio button clicked to slide & show hidden div & pass a value

  21. 21

    How to check a Radio button from the value of a table of mySQL

  22. 22

    Setting value on dynamic radio button with ng-repeat

  23. 23

    Android Radio Button Animation

  24. 24

    If radio button is checked not running

  25. 25

    using radio button with knockoutjs

  26. 26

    How to tick check-boxes on page load according to the value of radio button in jquery?

  27. 27

    Java Radio button clear/deselect

  28. 28

    PHP check if a radio button is clicked

  29. 29

    Radio button for enumerize in rails admin

뜨겁다태그

보관