goURL is a very small NPM package (developed by KingRayhan) that allows you to redirect any DOM element to a specific URL through a click event.
How to Install the Package
npm install gourl // or yarn add gourl
If you want, you can also add this functionality to your project through CDN.
<script src="https://unpkg.com/gourl" />
Include package to your project
require('gourl');
Now if you want to go to a specific link through a click event, you simply need to attach the data-href attribute to the DOM element.
Some Examples
<button data-href="https://www.google.com/">click</button> <button data-href="https://www.google.in/" data-target="_blank">click</button> <a href="#" data-href="https://www.facebook.com">facebook</a> <input type="text" value="instagram" data-href="https://www.instagram.com" data-target="_blank"> <br> <br> <span data-href="https://www.youtube.com" data-target="_blank">youtube</span>
Available attributes
data-href | put your hyperlink here to go |
data-target | put url target method. supported values _blank and _self (Default) |
Leave Your Comment