jQuery special characters causing issues -


i have simple script looking heading perform function when heading matched. running issues special characters copyright , registered trademarks.

var isdisclosure = $('.disclosure-container h3').html();  if ( isdisclosure == "awesome product<sup>&#174;</sup> disclosures" ) {         alert('zomg');     } 

the html looks in firebug:

<h3 class="inline">     awesome product     <sup>®</sup>     disclosures </h3> 

upon viewing source html looks this...

<h3 class="inline">awesome product<sup>&#174;</sup> disclosures</h3> 

so when add html if statement, added character , doesn't work... so...

if ( isdisclosure == "awesome product<sup>©</sup> disclosures" ) 

i open searching "awesome product" wildcard or @ end.

you use regex test partial match

if(/awesome\sproduct<sup>.+</sup>\sdisclosures/i.test(isdisclosure)) 

or index of

if(isdisclosure.indexof("awesome product") >= 0) 

or reference html hidden div.

<div id="refs" style="display:none;"> <h3 id="awesome">     awesome product     <sup>®</sup>     disclosures </h3> </div>  if(isdisclosure == $("#refs #awesome").html()) 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -