All I want to do is replace the letter "y" with the letter "i" in all s with a certain class. I'm not sure why my script isn't working. I know the selector is working because I can swap the method to something like hide() and it works. I also can assign the value of the replace() into a variable, and that variable shows the correct substitution. So I'm boggled why the combination of the two isn't working...
<script type="text/javascript" src=".../jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
$("span.certain_class").text().replace(/y/g, "i");
}
);
</script>';
EDIT: I need to clarify that I need to do this to multiple spans throughout the page. Remember that the text() method stacks up all the texts of each span... so something like this won't work:
$("span.certain_class").text($("span.certain_class").text().replace(...))
Each span will end up with a mess of the other span's text.