How to redirect

Hi!

I want some strip (or strip column or section) of my site to work like a link or button redirecting to another page.

I added onClick event to that element… and I don’t know what to add to Code panel. I’m not a programmer. So could somebody tell me what code I should place instead of

export function columnStrip1_click(event, $w) {
	//Add your code for this event here: 
}

?

Hello,

To navigate to other pages use wixLocation.to. See more information here .

import wixLocation from 'wix-location';

export function columnStrip1_click(event, $w) {
    wixLocation.to("/otherpage");
  }

  

Dear Ido,

Thank you very much for your reply!

I i did this, but now I get two alerts in the third string:

  • Parameter ‘event’ is never used

  • Parameter ‘$w’ is never used
    It seems I have to declare them. But I don’t know how to do this :frowning:

Those are warning that you don’t have to worry about. If your code works fine, you can safely ignore them.

Dear Sam, thank you for your comment!

Unfortunatelly that code did not work.

Fortunatelly I found one more similar discussion here: JS on-click on element class . Using the sample from it and a little bit of shamanism I got code that now works well (at least at my site).

Here is it:

import wixLocation from 'wix-location';

$w.onReady(function(){
	$w('#box1').onClick(function(){
		wixLocation.to("/rooms");
	});
});

$w.onReady(function(){
	$w('#column1').onClick(function(){
		wixLocation.to("/facilities");
	});
});

Thank you guys for your help! Since I’m not a programmer this simple stuff is a real miracle for me!

Hi All,

I’m trying to use “User input” ‘Switch’ to toggle between two websites… a very simple implementation.
There is going to be 2 different language websites (identical).

When user switch it on to ‘right’ it will redirect to English website and when it is turned off “left” it should go to the language website.

I’m not a coder but have done some basic implementations:
Can someone tell me what exactly I need to do… with code that I can use.

Thanks in advance,
Pawan

can anyone please tell me that how to redirect a button to another page, like just when we open someones website, there we get some clickable links or buttons to redirect to another page which shows some contents related to the first page…
same thing I want to do with my newly designed wix website but i got stuck in getting knowing of how to redirect a button to another page…please replyyy

Perhaps this may help you…
https://russian-dima.wixsite.com/meinewebsite/website-navigation

P.S.:
You should better open an own post with your own specific issue, to get a faster reply.