You have one close paren in the wrong place. You meant to call replace for dimensionString, not chaining replace call to attr call. ie. .attr("title", dimensionString.replace("&times;", "x"));