How Do I Attach A Value For If A Checkbox Is Checked In Html?
I want to make an assignment where people look up an e-mail on a list of websites. If there I no e-mail to be found, I want them to check a box. If they check the box I want it to
Solution 1:
From looking at the attached image I searched for 'crowd-checkbox' and found the documentation for that element. You can look at it here. If you go down to the 'Output' section you can see two examples of how you can set the value property of the checkbox element and how it looks when outputted as selected.
Solution 2:
Yes you can use on change
event of checkbox input:
In this code the span
content changes as checkbox value changes.
$('#email_chk').change(function(){
var res = this.checked? "Is checked": "Not checked";
$('.result').text(res);
});
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Email : <inputtype="checkbox"id="email_chk" /><br />
Result : <spanclass="result">Not checked</span>
Post a Comment for "How Do I Attach A Value For If A Checkbox Is Checked In Html?"