109
rated 0 times
[
110]
[
1]
/ answers: 1 / hits: 33614
/ 11 Years ago, thu, august 1, 2013, 12:00:00
Is there a way to make the following JavaScript if..else condition short, instead of writing if() else()
function two times is there any way to write if(x,y = ){} else{}
or something similar to make it shorter ?
$(document).ready(function(){
$(#third).click(function(){
var xxx = $(#first).val();
var xxy = $(#second).val();
if (xxx == ) {
alert(good);
}
else {
alert(bad);
}
if (xxy == ) {
alert(good);
}
else {
alert(bad);
}
});
});
More From » javascript