Page 1 of 1

<solved> Event on a link without changing/refreshing page

Posted: Thu Feb 16, 2012 2:19 pm
by trezel
Hi,

I need to put an onclick event on an element (text) of a page. But of course, I don't want the page to change (it must start a video at a defined time).
I've tried a lot of things, but it always goes to the index page, or refresh the page (I tried : href="#", {cms_selflink}, nothing in href...), or don't save the link (with empty href case).

Has someone a way to avoid this issue ?

Thank you

Re: Event on a link without changing/refreshing page

Posted: Fri Feb 17, 2012 7:09 pm
by spcherub
Hard to give advice confidently when your post does not include more details, but if you have a function you call on onclick(), end that call with "return false;" - this should, in theory, allow you to trap the call, do what you need, but change the default behavior.

Hope that helps.
-S

Re: Event on a link without changing/refreshing page

Posted: Mon Feb 20, 2012 8:36 am
by trezel
Hi,

That's exactly what I was looking for. It works.
Thanks