Just starting out with jQuery and this problem seems to be impossible to me. Search all the forums, no luck. Maybe you guys can help me?
My html looks kinda like this:
<form>
<table class="tableClassName">
[content]
</table>
<div class="divClassName">
[content]
</div>
Here is some text
<div class="divClassName">
[content]
</div>
</form>
The form has a buch of child elements. I only want to chance the text "here i som text", to something else. Is there some way i can leave all the child elements and only change this particular text?
Here is my noob code, so far:
$(document).ready(function() {
var oldText = "Here is some text";
var newText = "the new text";
var entireElement = $("form:contains(" + oldText + "):not(table, div)").html();
$("form:contains(" + oldText + "):not(table, div)").html(entireElement+newText);
});
As you can see this replaces nothing. It only puts my new text just before my </form>
.
What to do?