lundi 20 février 2017

Checkbox Check for yes command in javascript

I want to get done, When i try to checked checkbox, It will show popup. Then, there have a two option as "Yes" and "NO". When i click "yes" checkbox will checked and popup close. If i choose "NO" checkbox will unchecked and close popup. Give me a help on this. Sample code here

Javascript

$(document).ready(function () {
$('#chkBox').click(function () {
    if ($(this).is(':checked')) {
        $("#txt").dialog({
            close: function () {
                $('#chkBox').prop('checked', false);
            }
        });
    } else {
        $("#txt").dialog('close');
    }
});
});

HTML

<input type="checkbox" id="chkBox" name="HelpCheckbox" value="Help" />
  <div id="txt" style="display: none;">
       <button>Yes</button>
        <button>NO</button>
  </div>

Live sample here : http://ift.tt/2m2PLyC

Please help. Thank you.




Aucun commentaire:

Enregistrer un commentaire