Question on event handlers

Can we add two event handlers simultaneously to an element?

Hello!
Yes, with dynamic binding. I mean this:

$w.onReady(function () {
	$w("#button2").onClick(() => {
		console.log("first action!");
	});
	$w("#button2").onClick(() => {
		console.log("second action!");
	});
});
1 Like

Thankyou very much!
Much appreciated

Can you help me out here?
I want to add another event to button 34 so that when a user clicks log in, he is logged in and simultaneously directed to a dynamic page(with just one click).

You should use this - https://www.wix.com/code/reference/wix-location.html#to

notice that you actually should generate url by yourself. I mean prefix + key field of dynpage

From article about members profile page, you can just add this - wixLocation.to(/Members/${wixUsers.currentUser.id});

anywhere, so navigating will hapeen after login
On your screen there is not enough code to show where to insert it)

I took example from article and inserted this code -

https://www.screencast.com/t/4d5fn3Fl

You should add this line after
$w(“#profileButton”).show();

1 Like

Ok thankyou!