I am trying to run a code but I get
$.uniform is undefined
[Break on this error] $.uniform.restore("#f_variedbyoperator");
How can I use jQuery, to detect if .uniform
has been defined? And to signup the code to run after that.
I am trying to run a code but I get
$.uniform is undefined
[Break on this error] $.uniform.restore("#f_variedbyoperator");
How can I use jQuery, to detect if .uniform
has been defined? And to signup the code to run after that.
The same way you'd test any other property:
$.hasOwnProperty('uniform')
(true if it is defined), ortypeof $.uniform === 'undefined'
(true if it is not defined), or!!$.uniform
(true if it is a truthy value - anything other than undefined
, null
, 0
, false
, or ''
- the empty string)What do you mean "signup the code to run?"
var i = setInterval(function ()
{
if ($.uniform)
{
clearInterval(i);
$.uniform.restore("#f_variedbyoperator");
}
}, 1000); // check for $.uniform every 1000 ms
If all you want to do is check that an element exists, try:
if($('element').length)
{
// exists!
}