Advertisement

05.20.2008 at 08:29AM PDT, ID: 23417566
[x]
Attachment Details

jquery newbie... Help with If then else statement

Asked by jweissdandm in Asynchronous Javascript and XML (AJAX), JavaScript, Extensible Markup Language (XML)

Tags: jquery, firefox

I am new to jquery and I have some code from a friend..

I want to add a criteria to the code below to accommodate

$(this)).attr("value")=="UnitedStates")

and

$(this)).attr("value")=="Canada")

a basic if then statement.

Thanks

An even simpler example of an 'if then' would be appreciated. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
$(document).ready(function() {
    $("#selcountry").change(function() {
        if ($("option:selected", $(this)).attr("value")=="UnitedStates") {
            $("#zipcodefield:hidden").show();
            $("#distancefield:hidden").show();
        } else {
            $("#zipcodefield:visible").hide();
            $("#distancefield:visible").hide();
            $("#zipcodefield input").val("");
            $("#distancefield option:selected").removeAttr("selected");
            $("#distancefield option[value='25']").attr("selected","selected");
        }  
		
    });
});
 
Keywords: jquery newbie... Help with If then e…
 
Loading Advertisement...
 
[+][-]05.21.2008 at 09:39PM PDT, ID: 21620928

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.22.2008 at 10:37AM PDT, ID: 21625892

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 12:24AM PDT, ID: 21630043

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Asynchronous Javascript and XML (AJAX), JavaScript, Extensible Markup Language (XML)
Tags: jquery, firefox
Sign Up Now!
Solution Provided By: wilq32
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628