wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Can you have nested if statements in jQuery? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Can you have nested if statements in jQuery?" Watch "Can you have nested if statements in jQuery?" New topic
Author

Can you have nested if statements in jQuery?

Mark Warner
Greenhorn

Joined: Aug 12, 2010
Posts: 10
In a select statement if "Credit_Card" is selected then I have some form fields enabled. What I want to do is enable the field explain_other if another select statement (bank_cc_trans_type) is set to "Other". However my inner nested if statement is not working.



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

jQuery doesn't change anything about how the fundamentals of JavaScript work, so how if statements work is completely orthogonal to the use of jQuery.

Can you please explain what "is not working" means? (see ItDoesntWorkIsUseless)


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

Joined: Jan 10, 2002
Posts: 60082
    
  65

P.S. Give your info so far, I would set a breakpoint at line 11 and see what the condition evaluates to.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well first thing is you want to use prop() and not attr() for setting the disabled state of the element with jQuery 1.6+.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can you have nested if statements in jQuery?
 
Similar Threads
Datepicker Validation
Enable/Disable a Button
Enable/Disable the datepicker
how to use jquery to make form fields required on submit?