Search code examples
jqueryeventsjquery-mobile

jquery - how to query for options passed with event


I'm listening for an event and when fired, I want to check some of the associated options.

This is what I have:

// event firing
$.mobile.changePage(href, {fromHashChange: false});

// listening
$(..target..).bind('changePage', function(event, data) {
   console.log(data)
   });

The console returns the options set in the function call. I'm just not getting anywhere trying to query for the individual options...

Question: how can I query for fromHashChange?

EDIT
This is the working solution:

console.log(data.object.fromHashChange);


Solution

  • You should be able to do -

    var x = data.fromHashChange;
    

    or

    var x = data['fromHashChange'];