title: Check if a string has a span tag around it using jQuery?
body: <pre><code>var text='word &lt;span&gt;otherword&lt;/span&gt; theotherword';
  </code></pre>
  
  <p>I will iterate all characters of text and check if a character has a span tag around it. In this case,  o-t-h-e-r-w-o-r-d characters have span tag. How can I check if span tag exists around characters?</p>
  
  <p>I mean: i want to check all characters in the text through iterating them and see if it has span tag around the word that it belongs to.Because i need to replace characters with &amp;nbsp except characters within words that have span element. </p>
  
  <pre><code>&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span&gt;otherword&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;...
  </code></pre>