javascript - jquery highlight words only -


I only want to highlight words and words, for example I do not want to highlight the words "ant Hit elephants "Here I just want to highlight ant ... but as I have highlighted the code I

  jQuery.fn.highlight = function (pat, className, CaseSen) {function innerHighlight (node, pat) {var skip = 0; If (node.nodeType == 3) {if (caseSen == false) {var pos = node.data.toUpperCase () IndexOf (pat);} else {var pos = node.data.indexOf (Pat); } If (condition> = 0) {var spannode = document.createElement ('span'); Spannode.className = className || 'Exposed'; Var middlebit = node.plitText (pos); Var Endbit = MiditusPlatchText (Pat Length); Var middleclone = middlebit.cloneNode (true); Spannode.appendChild (middleclone); Middlebit Parentnode. Revolving (Spandode, Middlebida); Leave = 1; }} And if (node.Nodtip == 1 & amp; amp; node.childnodes & amp; / / Script (style | style) /i.test (node.tagName)) {for (var i = 0; i & lt ; Node.childNodes.length; ++ i) {i + = Internal Highlight (node.cildnode [i], pat); }} Skip withdrawal; } Come back. (Function () (If Case Case == Wrong) {InherHighlight (it, Pat., Opp.);} And (Internal Highlight (it, Pat);}});   

};

When I highlight the "ant elephant can kill" I just want to make the ant ridiculous.

I am using the content editable device

  function innerlightlight (node, pat) {var html = node.innerHTML; var rexp = new RegExp ('\\ B ('+ pat +') \\ b ',' igm '); html = html.replace (rexp,' & lt; span class = "hl"> gt; $ 1 & lt; / span & gt; ); Node.innerHTML = Html;}   

and a sample

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -