Reputation: 67283
How would you go about finding a string constant that is not HTML-safe?
It appears the following searches for the individual characters.
var i = text.indexOf('»')
Upvotes: 2
Views: 679
Reputation: 7902
You'll first need to unescape the HTML in the pattern:
var i = text.indexOf(decodeHTML('»'));
function decodeHTML(s) { // e.g. using jQuery
return $('<div>' + s + '</div>').text();
}
Upvotes: 1
Reputation: 5491
var i = text.indexOf('\273')
would search for the actual character.
http://www.c-point.com/javascript_tutorial/special_characters.htm explains how to escape special characters in javascript.
Upvotes: 0
Reputation: 53921
Try looking at the html directly.
document.getElementById('search').innerHTML.indexOf('»')
Upvotes: 0