Using jQuery find string A or B and replace based on css class and ID
Posted
by
Jason
on Stack Overflow
See other posts from Stack Overflow
or by Jason
Published on 2013-07-01T16:10:43Z
Indexed on
2013/07/01
16:21 UTC
Read the original article
Hit count: 168
jQuery
Using jQuery, how do you check for and replace the occurrence of stringA or stringB when it falls under a specific css class and ID?
stringA = " | "
stringB = "|"
css = .login #bav
<p id="nav">
<a href="#">oh ya</a> |
<a href="#" title="Password Lost and Found"></a>
</p>
I have variations of this:
jQuery(document).ready(function($) {
$(".login #nav").replaceText( /testA|testB/gi, "fooBar" );
});
});
© Stack Overflow or respective owner