Href For EveryThing - Add href attribute to all html tags and use to link pages...
source link: https://github.com/Niyko/href-For-EveryThing
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Href For EveryThing is a small script that can be used to add href attribute to all html tags and use to link pages like anchor tag. HREF attribute will work as a normal anchor tag, The cursor is set to pointer automatically. href For EveryThing also supports dynamic html, href For EveryThing will automatically detect dynamic tag or content insertions and work as normal. No more wraping everything in anchor tag to use link. Demo is vailable in codepen, Check it out, https://codepen.io/niyko/pen/XWmYvPN
Get started
1) Add the CDN scripts
href For EveryThing
needs jquery
to work, So add the CDN of jquery if not already added. Then add the href For EveryThing.js
CDN into your project.
<!-- JQUERY --> <script src='https://code.jquery.com/jquery-3.5.1.js'></script> <!-- HREF FOR EVERYTHING --> <script src='https://cdn.jsdelivr.net/gh/Niyko/href-For-EveryThing/src/hrefForEveryThing.js'></script>
2) Add href to any html element
Now you can add href
attribute to any HTML
element as you want. When that element is clicked, the given link, Like :
<button href="http://google.com">Click me</button> <div href="http://google.com">Click me</div> <h1 href="http://google.com">Click me</h1>
Example
href For EveryThing
example is available in codepen
, Check it out : https://codepen.io/niyko/pen/XWmYvPN
License
Href For EveryThing is licensed under the MIT License .
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK