I have a div (contenteditable="true") which contains some html. I’m trying to replace text in the entire div except in links with a certain class.
I tried:
$('div#text').not('a.selected').each(function() {
$(this).html = replaceFunction($(this).text))
});
But it doesn’t replace anything.
Your selector will never return anything. You are saying “give the div with id=text where it is not an a element with class=selected”. Use
.children()to get the children of the div..htmland.textare methods. You can’t assign to them. They have overloads for getting and setting:.html()will get the html..html(newhtml)will set the html.You want something like this: