jquery - Assign different value if element exists -
I am trying to allocate one of two values in a variable, depending on whether an element Exists or not. I thought that something like this should work ...
$ optsH = function () (if (jq ('# option'). Length> gt; {return jq ('# Options') .outerHeight ();} and {return 0;}} ... but not.
I know it should be simple , But it has been a long day.
Very well you forgot to call your function ; >> $ optsH = (function () {if (jQ ('#options'). Length> gt; return jQ ('# options'). OuterHeight ();} else { Return}}}} () If you do this however It is a better way to:
$ optsH = jQ ('# options'). OuterHeight () || 0;
Comments
Post a Comment