Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uudashr/jquery-linkify
jQuery plugin to enable clicking on URL and hashtag
https://github.com/uudashr/jquery-linkify
javascript jquery
Last synced: about 2 months ago
JSON representation
jQuery plugin to enable clicking on URL and hashtag
- Host: GitHub
- URL: https://github.com/uudashr/jquery-linkify
- Owner: uudashr
- License: apache-2.0
- Created: 2011-11-19T16:50:26.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2019-12-05T03:01:56.000Z (about 5 years ago)
- Last Synced: 2023-03-13T07:45:54.133Z (almost 2 years ago)
- Topics: javascript, jquery
- Language: JavaScript
- Size: 19.5 KB
- Stars: 45
- Watchers: 3
- Forks: 33
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Linkify jQuery Plugin
Linkify is jQuery plugin to formatting the text that contains URL or hashtag into a clickable HTML content.
It's small, it has no test suite but handles the large majority of cases, with exceptions (e.g. detecting modern TLDs like .museum properly, or punctuation at the end of the URL). For advanced options, check out the [linkify](https://github.com/cowboy/javascript-linkify) or the [urlize](https://github.com/ljosa/urlize.js) library.
## Usage
Include the plugin script
``` html
```
``` js
$("#content").linkify();
```
or to enable the hashtag link``` js
function toHashtagUrl(hashtag) {
return "http://myservice.com?q=" + hashtag;
}$("#content-with-hashtag").linkify(toHashtagUrl);
```or if you want to disable the URL that does't include http
``` js
function toHashtagUrl(hashtag) {
return "http://myservice.com?q=" + hashtag;
}$("#content-with-hashtag").linkify({
hashtagUrlBuilder: toHashtagUrl,
includeW3: false
});
```or to specify the target for links
``` js
$("#content").linkify({
target: "_blank"
});
```