aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Is Checkbox checked by name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Is Checkbox checked by name?" Watch "Is Checkbox checked by name?" New topic
Author

Is Checkbox checked by name?

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1391
This code seems to always act as is check box is checked even when I un check it.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

The expression $("input[name='usertextmsgcntrl']:checked") always returns a jQuery wrapped set, which is truthy, so the expression always evaluates to true.

What you want to check is the length of the set. If the checkbox is checked the wrapped set will not be empty.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1391
Thanks Bear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is Checkbox checked by name?
 
Similar Threads
How to add the objects to the arraylist class if object has many states
What does this error mean??
NullPointerException when removing objects, for which equals() is overriden, from JComboBox
checkbox
get value from radio button