fancy wording
spell checker, and meaning usage.
by Imri Paloja
HTML
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<div>
<p>
Thered iss somethingf i wantt yoeu toe knoww, i can'rt spellll.
</p>
</div>
<br><br><br><br><br><br><br><br><br><br>
<hr>
<ul>
<li><a href="http://stackoverflow.com/questions/5080958/how-to-add-a-tag-to-a-word-inside-a-div-using-javascript" title="stackoverflow" target="_blank">How to add a tag to a word inside a div using javascript</a></li>
<li><a href="http://stackoverflow.com/questions/8968419/how-to-append-a-a-tags-to-specific-words-in-an-element-with-jquery" target="_blank">How To Append Tags To Specific Words In An Element With jQuery</a></li>
<li><a href="http://stackoverflow.com/questions/9650347/javascript-how-would-i-find-certain-class-and-add-span-with-numbered-id-to-each" target="_blank">Javascript: How would I find certain class and add SPAN with numbered ID to each word?</a></li>
<li><a href="http://stackoverflow.com/questions/10820437/in-html-or-css-how-can-i-set-a-specific-word-to-always-be-a-certain-colour" target="_blank">In html or css how can I set a specific word to always be a certain colour?</a></li>
</ul>
CSS
hr {
border: 1px solid #CCCCCC;
}
JavaScript
//function mispelt (el, word, class) {
// replaces all occurrences of the string 'word' in the element
// 'el' with a span which has a class 'class'
// Assumes 'word' contains no regexp special chars
//el.innerHTML = el.innerHTML.replace (
// RegExp ('\\b(' + word + ')\\b', 'ig'),
//'<span class"' + class + '">$1</span>'
// );
//
$(function() {
var regExp = new RegExp("\\b(" + "hashtag" + ")\\b", "gm");
$('div, p, span').each(function() { // use your selector of choice here
var html = $(this).html();
$(this).html(html.replace(regExp, "<a href='#'>$1</a>"));
});
});