Opening the Sign in Dropdown from a button

Hi,

I’m using the ian:accounts-ui-bootstrap-3 package and the {{> loginButtons}} helper to create a login dropdown in my menu bar. Everything works fine. But now I try to open this dropdown from another button. The code I tried is

    'click [data-action="doSignIn"]': function (e) {
	e.preventDefault();
	if (Meteor.isClient) $("#login-dropdown-list").toggleClass('open');
    }

The event fires if I click the anchor element with the data-action attribute but the dropdown doesn’t open. The code works if I just enter it into the console.

My guess is, that it has something to do with the encapsulation of templates, since the anchor and the dropdown are in different templates. But my understanding was, that $(…) would work for the whole page and only template.$(…) is restricted to the template.

So… anyone has an idea to solve this problem?

Thanks in advance!

Could you simulate a click on the link?

If you call that jQuery statement - $("#login-dropdown-list").toggleClass('open'); or whatever in the console, and then click the dropdown, does it dropdown like it should?

Okay, I figured it out after building it in MeteorPad (http://meteorpad.com/pad/pHDLYqxKwdT4HRa9C/DropdownTest)

For some reason, there it worked perfectly. I now fixed it on my site by adding “return false;” at the end of the event.