Can a program have a few IFs and only one Else structures?
Posted
by kwokwai
on Stack Overflow
See other posts from Stack Overflow
or by kwokwai
Published on 2010-06-10T17:21:56Z
Indexed on
2010/06/10
17:22 UTC
Read the original article
Hit count: 210
jQuery
Hi all,
When I was doing some JQuery and PHP,
I noticed the If-else patterns were treated differently and varied from one language to another
.
Say I got a simple input text field in a HTML
and I was using some Ifs and Elses to check the
value input into the text field.
Text: <input type="text" name="testing"/>
In JQuery, I got some codes as follows:
if($("#testing").val()==1){
//do something
}
if($("#testing").val()=="add"){
//do something
}
else{
//do something
}
if($("#testing").val()=="hello"){
//do something
}
How come JQuery and PHP treated the Else statement differently?
I mean in JQuery, the third If statement was
still proceeded even if it had gone to the Else statement,
but it stopped after the Else statement when I repeated the code in PHP script.
© Stack Overflow or respective owner