0

I have an echo in my php page which has a javascript in it.

it looks like this:

echo '<ons-list-item onclick="fn.load('home.html')" tappable>';

I need to escape the single quotes on fn.load('home.html')

so i did:

 echo '<ons-list-item onclick="fn.load(/'home.html'/)" tappable>';

But that doesn't really work..

could someone please advise on this?

Thanks in advance.

1 Answer 1

2

Try using double quotes around "home.html".

Or you need to escape ", so it won't be interpreted as end of string. Use \ to escape the quotes as you said.

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

2 Comments

with double quotes, my javascript stops working. so i need to use single quotes.
OK try using the backslash before to escape the quote using a backslash. Like thus 'hello\'s'

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.