Search code examples
jqueryjquery-bbq

jquery BBQ - if parameter doesn't exist function


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


Solution

  • It will return undefined.

    This is what the test could look like:

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