aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery and checkbox 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 "jQuery and checkbox" Watch "jQuery and checkbox" New topic
Author

jQuery and checkbox

Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10
I want to set chkHead to true when both chkTbl are true and vice-versa..
But nothing seems to work...

can anyone help??

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Your script must be in a ready handler. It is executing before the DOM is even loaded so there's nothing to apply methods to.

You're also mixing up classes and id values. Get them straightened out.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

P.S. chkTbl and chkHead are horrible, unreadable names. What did vowels ever do to you? Why not choose nice readable names with the vowels left in?
Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10
I had an alert in the click event for chkTbl and it worked when the checkbox was selected/deselected...
So that is not an issue I guess...
Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10
This is a small part of code from an application.. Sorry for horrible names.. they are just there since eternity..
Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10


Sorry
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Malini Rao wrote:I had an alert in the click event for chkTbl and it worked when the checkbox was selected/deselected...
So that is not an issue I guess...

Nope. Impossible as the code is written.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Please post back the code once you've got it straightened out. (assuming you still having issues after fixing this problems.)

By the way, it was a good call to pare the code down to a small example rather than posting huge code blocks. Most people will just ignore those.
Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10
Sorry about that.. I had just put the main parts.. forgot about document.ready...
This one works.... And explained more clearly...
Thanks
Malini Rao
Greenhorn

Joined: Mar 30, 2012
Posts: 10
And I am using jquery 1.4 if that helps...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Please do not go back and change a post after you've made it. It just makes the replies that have already been made look stupid.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery and checkbox