Open a popup from the «href» of a link

Today I found a problem that seemed silly but ultimately cost me a while to find the solution.

The problem is I was using a javascript component that «paints» a menu. This component receives a N dimensional matrix representing the menus and submenus.

Simplifying, this array receives for each menu item text to display and the URL where it has that option menu. Finally, the component generates something like this:


The problem has come when I need has arisen that one of those links would open a popup, instead of redirecting to an URL.

In a normal environment it would be easy enough to do something like this:


But the component does not allow me to put code in the «onclick» so the choice was to play with the parameter «URL» was wrong for opening the popup.

I tried several options:





And managed to open the popup but then the page is reloaded and showed simply «[OBJECT], so it was not worth the solution. Much» return false; «that poking.

In the end the solution has been to write this:

TEXTOpen a popup from the "href" of a link

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.

Loading Facebook Comments ...