javascript function indexOf() not working in chrome with white space in string
<p>I want to search the string in anchor tag, When I simply search the "Happy" without space it works fine however when I search it with some space like "Happy " it does not work.</p>

<p>Below is the code sample:</p>

<pre><code>&lt;html&gt;
&lt;body&gt;

 &lt;a style="color:#555555" href="Happy coding!!"&gt;test&lt;/a&gt;
&lt;br/&gt;

&lt;script type="text/javascript"&gt;

var hrefTags = document.getElementsByTagName("a");
var bDayId = ""; 
var stringToSearch = "Happy coding!!";
    for(var hrefIndex=0; hrefIndex &lt; hrefTags.length; hrefIndex ++){
bDayId = hrefTags.item(hrefIndex).href.toString(); 
document.write(bDayId+"&lt;br/&gt;");
document.write( bDayId.indexOf("Happy "));  
     }  

&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
