I’m modifying a custom form builder app written in C# by adding onblur to replace problematic characters like <> /\ and hopefully " . I can get all replaces to work except for the double quotes due to my 2 double quotes issue. Can anyone help me get this to work?
Here’s a bit of my code:
this.Controls.Add(new LiteralControl(String.Format(@"
... lots of html ...
<input name=""txtTextLabel"" id=""txtTextLabel"" type=""text"" onblur=""this.value = this.value.replace('<', '[').replace('>', ']').replace('double quotes', '');""/>
... lots more html ...
"));
The below works for me:
I’ve put a \ before the double quote because that’s how you escape the double quote in Javascript.
Note that in the onblur attribute I’ve reversed your usage of the single and double quote in order for it to work.
Also I realise that in your code you’re replacing < with [ and > with ]