jquery BBQ - if parameter doesn't exist function

678 Views Asked by At

How would I use jquery BBQ to check if a parameter exists and if it does not then run a function?

I'm assuming that $.deparam.fragment().srhTerm; is what I would use, however if srhTerm doesn't exist in the url, does it return false or null?

thanks

1

There are 1 best solutions below

0
Jonas G. Drange On BEST ANSWER

It will return undefined.

This is what the test could look like:

if( typeof($.deparam.fragment().srhTerm) == 'undefined' ) {
    // do stuff
}