Search code examples
javascriptjqueryinvisible

How to set invisible false only a charator of a string using js or JQuery


I am having a string

"Custormer1#-#Project1".

I want to invisible the two #s in the string? Can I do this without replacing the character using javascript or JQuery?


Solution

  • The only option you have is to wrap them in a <span>-element and hide that span with CSS.

    Check this fiddle for an example: http://jsfiddle.net/CJefw/ and note that the text() method in jquery still returns the right content, without the added spans.