My webpage contains multiple paragraphs with the same class name. I need to remove a specific character from all of them. My attempt at using jQuery is as follows:
var str = $(".foo").html;
var res = str.split(" ").join("");
$(".foo").html = res;
Unfortunately, this code snippet results in an error:
TypeError: str.split is not a function
I have observed that when I target a single paragraph using its unique Id, the code works perfectly. However, it fails when attempting to apply it to multiple paragraphs with the same class names simultaneously.