Simon
Simon

Reputation: 35

Can I hide a specific character (,) from the browser?

Complete noob here. The CMS I'm forced to use is spitting out commas (,) on a page and I want to hide them from the viewer as they are messing up my layout.

The code (that I CANNOT edit) typically looks like this:

<img class="" src="https://via.placeholder.com/350x150"> , <img class="" src="https://via.placeholder.com/350x150"> , <img class="" src="https://via.placeholder.com/350x150"> ,

I can however wrap the above html in a div. I can also add and javascript or jquery to either the header or footer of the page. The page contains multiple instances where there are blocks of images- sometimes I might have 4 or 5 images together - all are currently being comma separated. These commas are appearing in the browser and it's these that I want to remove.

A working demo where these commas are removed would be amazing. Thanks all who read this.

Upvotes: 1

Views: 374

Answers (1)

Rafael Guglielmi
Rafael Guglielmi

Reputation: 64

Not the prettiest solution but I think you can get the point. Just strip the commas from the contents of the div, since you said you can do that.

container.html().replace(/,/g, "")

Example on JSFiddle

Upvotes: 1

Related Questions