Title: Colouring problem
Last modified: August 21, 2016

---

# Colouring problem

 *  Resolved [Vikestart](https://wordpress.org/support/users/vikestart/)
 * (@vikestart)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/colouring-problem/)
 * Hey, I love your plugin 🙂 But there is one problem
 * If the last word is assigned a colour, it will end up as a widow without colour.
 * This is because the plugin inserts `&nbsp;` inside the `<span>` like this: `<
   span style="color:&nbsp;#00ff00;">` and breaks the CSS.
 * Is there a way you can make it ignore those span tags?
 * [http://wordpress.org/plugins/widont-part-deux/](http://wordpress.org/plugins/widont-part-deux/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Morgan Estes](https://wordpress.org/support/users/morganestes/)
 * (@morganestes)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/colouring-problem/#post-4232353)
 * I’ll take a look at this. It’s a pretty basic reffed, but I can probably extend
   it to insert the nbsp before any tag.
 *  Thread Starter [Vikestart](https://wordpress.org/support/users/vikestart/)
 * (@vikestart)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/colouring-problem/#post-4232356)
 * I think I found a solution 🙂
 *     ```
       $(document).ready(function($){
       	$('p').html(function(i, oldHtml) {
       		var html = $(this).html();
       		var split = html.split(' ');
       		if ( (split.length > 1) && (!$(this).find('img').length) ) {
       			return oldHtml.replace('<span style="color: ', '<span&nbsp;style="color:&nbsp;').replace(/(\d),\s/g, '$1,').replace('<span&nbsp;style="color:&nbsp;', '<span style="color: ');
       		}
       	});
       });
       ```
   
 * It inserts a non-breaking space in those tags before it attempts to insert a 
   non-breaking space between the two latest words, it then avoids putting that 
   inside the tag. Afterwards, the script removes the non-breaking spaces from the
   inside of the tag. 🙂
 *  Plugin Author [Morgan Estes](https://wordpress.org/support/users/morganestes/)
 * (@morganestes)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/colouring-problem/#post-4232394)
 * Turns out this was an issue that affected all tags that contain attributes, not
   just this case.
 * Version 1.3.1 has been released that should fix this across all tags.

Viewing 3 replies - 1 through 3 (of 3 total)

 The topic ‘Colouring problem’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widont-part-deux.svg)
 * [Widon't Part Deux](https://wordpress.org/plugins/widont-part-deux/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widont-part-deux/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widont-part-deux/)
 * [Active Topics](https://wordpress.org/support/plugin/widont-part-deux/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widont-part-deux/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widont-part-deux/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Morgan Estes](https://wordpress.org/support/users/morganestes/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/colouring-problem/#post-4232394)
 * Status: resolved