144
rated 0 times
[
145]
[
1]
/ answers: 1 / hits: 21357
/ 12 Years ago, fri, april 13, 2012, 12:00:00
Actually two questions:
I like the shorthand IF-ELSE in jQuery like so:
var some == true ? it's true : it's false;
Is there a corresponding IF-THEN, because this:
var some == true ? it's true
doesn't seem to work.
Also, would something like this be chainable in regular jQuery? Like so:
some.addClass(hello)
.find(.other).css(width,100px).end()
// chained if
.hasClass(one) ? some.css(border,1px solid red)
.removeClass(hello)
Now that would be nice, wouldn't it? Is this possible?
More From » jquery