0

I am having trouble with adding the buttonClassvariable into the class attribute. How can I escape the double and single quotes here?

 String buttonClass= changed ? "changeButton" : "dontChangeButton";
 button.append("<input id='" + id + "' type='button' value='" + buttonValue + "' class='" + buttonClass
 + "' ui-button ui-widget' />");

2 Answers 2

2

You can use backslash for escaping character, or post the string on this website and let it do the work for you: http://www.freeformatter.com/java-dotnet-escape.html

Sign up to request clarification or add additional context in comments.

Comments

0

By using backslash "escape" operator ie: "\"Hello Quotes\"";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.