This is probably a basic, nooby question but I have a JS function which toggles specific text (in this case Unicode, both characters are capable of being displayed). JS Fiddle here.
HTML Here:
<div class="header" style="cursor: pointer;"> <span class="arrowTog">▶ </span>
<b>Merchant</b>
JS Here:
$('.header').on('click', function () {
var arrow = $(this).find('.arrowTog');
if (arrow.text().contains('▼')) {
arrow.text('▶');
} else {
arrow.text('▼');
}
});
This works properly in Firefox, with the "arrow" toggling to the down position. However, this does not occur on Chrome. I just get an error that says: "Uncaught TypeError: arrow.text(...).contains is not a function".
Does anyone have any idea of what could be causing this error, and what can I do to enable it to work properly across browsers? Thanks