jQuery: wrap around substring...close, but not quite -
I am trying to select substrings - in character counting, in square brackets - in many paragraphs and each of them Wrap a class with Follow my Nob jQuery conformation: It seems that as long as the My Bela is: Thank you. If you are feeling full, you can type categories and Here's a working child: & lt; Span & gt; In the tag, the "four way," applied here is HTML for one, and CSS:
span.char_count {padding-top: 0; Color: # FF 6600! Important; }
var select_p = $ ('div # promo_area div.featured_box p'); Select_p.each (function () {var first_index = $ (this) .html (). IndexOf ('[']; var last_index = $ (this) .html (). IndexOf (')') + 1; var selected_text = $ (This) .html (). Substrings (first_ index, final_index); selected_text.Wap ('& lt; span class = "char_count" />;);});) ???
.wrap line works fine - I get the right subkey in
selected_text . Wrap yourself does not work What small thing is I doing wrong? Or is this a stupid big thing?
border brackets You can try to implement a solution using, or you can use the plugin to make it easier:
$ (this). Highlight (selected_text, {element: 'span', className: 'char_count'});
Comments
Post a Comment