2

I have JavaScript in my template file, because of the smarty can't include the file and I have W3C problem validation:

addMarker({$item->lat}, {$item->lng}, '<div style="height: 280px;">dfdsfsd</div>');

Error element not allowed.

Is there a way to escape it somehow?

2 Answers 2

3

Split the start-tag and end-tag open delimiters:

addMarker({$item->lat}, {$item->lng}, '<'+'div style="height: 280px;">dfdsfsd<'+'/div>');

Or replace them by escape sequences:

addMarker({$item->lat}, {$item->lng}, '\x3Cdiv style="height: 280px;">dfdsfsd\x3C/div>');
Sign up to request clarification or add additional context in comments.

Comments

1

Better split it '<d' + 'iv and also the end tag otherwise you'll get an "end tag without start tag" error.

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.