jQuery get checkbox checked attribute value

We usually use attr() to get attribute values. 

But attr() also has bad times, such as getting the attribute value of the checkbox checked

This is another jQuery method we can use prop()

$('input').prop('checked')

//true => checked

//false => unchecked

Also: this is just one of the ways to tell if a checkbox is checked

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326044233&siteId=291194637