2

I'm trying to open the rokbox login module through jquery. I want the pop up to appear as soon as the page (and the js) loads.

Normally the popup is triggered when a url is clicked which looks like this:

<a rel="rokbox[355 385][module=rt-popuplogin]" href="#">Login</a>

How would i trigger the pop up to appear with jquery?

I already tried using the click and trigger events with no avail. That line of html is btw loaded on the page. I just need to trigger the click event which doesn't seem to work...

It is wrapped in a span with id #login so I selected the child with .find("a") and then binding the click to it, but nothing.. Ideas?

Nick
  • 2,862
  • 5
  • 34
  • 68

1 Answers1

2

You could consider something like that to use native JavaScript handlers:

if (document.createEvent) {
    jQuery('#login').find('a').get(0).dispatchEvent('click');
} else {
    jQuery('#login').find('a').get(0).fireEvent('click');
}

More details in this topic: How to trigger event in JavaScript? in-javascript

Community
  • 1
  • 1
WooDzu
  • 4,771
  • 6
  • 31
  • 61
  • This almost worked. I changed the dispatch and fireevent to just .click() and it worked :) – Nick Jun 08 '13 at 12:37