Dave's Brain

Browse - Programming Tips - How can I see if jQuery object is checked?

Date: 2017may12
Update: 2017aug21
Library: jQuery
Language: javaScript

Q.  How can I see if jQuery object is checked?


function isJqObjChecked(jqueryObj) { var isChecked = false; jqueryObj.each(function() { isChecked = this.checked; }); return isChecked; }
// More compact but less robust function isJqObjChecked(jqueryObj) { return jqueryObj[0].checked; }
function exampleUse() { var isChecked = isJqObjChecked($('#mycheckbox')); }

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.