Dave's Brain

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

Date: 2017may12
Library: jQuery
Language: javaScript

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

A.

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-2017, 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.