jQuery Plugin For Replacing Synonyms Within Text - Synonyms
| File Size: | 8.35 KB |
|---|---|
| Views Total: | 988 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
Synonyms is a jQuery plugin which automatically tags specified words within the text and allows to replace them with the synonyms from a suggestion popup.
How to use it:
1. Put jQuery library together with the synonyms.css and jquery.synonyms.js into your web project.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="jquery.synonyms.js"></script> <link rel="stylesheet" href="synonyms.css">
2. Create an editable element using the contenteditable="true" attribute.
<div contenteditable="true"> ... </div>
3. Call the function on the element you just created and specify a list of synonyms you want to use.
$('div').synonyms(options = {
'thesaurusRaw': [
['jquery', 'javascript', 'zepto'],
['react', 'angular', 'react-native']
]
});
4. More configuration options with default values.
$('div').synonyms(options = {
'thesaurusRaw': [
['jquery', 'javascript', 'zepto'],
['react', 'angular', 'react-native']
],
// maximum number of synonyms
maxSynonyms: 6,
// shuffle synonyms
shuffleSynonyms: true,
// limit the number of characters
characterCountLimit: null,
// callback
replaceCallback: function(){}
});
This awesome jQuery plugin is developed by andrewjgremmo. For more Advanced Usages, please check the demo page or visit the official website.





