Template:PopupLink: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
[{{{1|#}}} {{{2|Click here}}}] | |||
<script> | |||
document.addEventListener('DOMContentLoaded', function() { | |||
var links = document.querySelectorAll('a[href="{{{1|#}}}"]'); | |||
links.forEach(function(link){ | |||
link.onclick = function(e){ | |||
e.preventDefault(); | |||
window.open(link.href, '{{{4|_self}}}'); | |||
}; | |||
}); | |||
}); | |||
</script> | |||
</includeonly> | </includeonly> | ||
<noinclude> | <noinclude> | ||
Usage: {{PopupLink|URL|Link Text|Popup Text|Target}} | Usage: {{PopupLink|URL|Link Text|Popup Text|Target}} | ||
Target can be _blank, _top, etc. | |||
</noinclude> | </noinclude> | ||
Revision as of 22:03, 6 September 2025
Usage:
[URL Link Text]
<script>
document.addEventListener('DOMContentLoaded', function() {
var links = document.querySelectorAll('a[href="URL"]');
links.forEach(function(link){
link.onclick = function(e){
e.preventDefault();
window.open(link.href, 'Target');
};
});
}); </script>
Target can be _blank, _top, etc.