Кавычки (" "), параграф и пробел, вызывающие проблемы
Я использую всплывающую подсказку Prototype и не могу использовать кавычки (" "), абзац и т. Д. В контенте. Ниже приведен образец.
<div style="margin-right: 2px" id="bio" class="masters-bio">Bio</div>
<script type="text/javascript" language="javascript">
new Tip('bio', "Lorem ipsum "dolor" sit amet, consectetur adipiscing elit. Ut rhoncus mollis tincidunt. Curabitur rhoncus suscipit dui, quis tristique est posuere in. Nam in pretium tellus.", {
title: "Bio",
closeButton: true,
showOn: 'click',
hideOn: { element: 'closeButton', event: 'click'},
stem: 'bottomMiddle',
hook: { target: 'topMiddle', tip: 'bottomMiddle' },
offset: { x: 0, y: -2 },
width: '300px',
style: 'protogrey'
});
</script>
3 ответа
Решение
Используйте обратную косую черту, чтобы избежать кавычек. Просто положи \
перед каждым из них внутри вашей строки. Пример:
"Lorem ipsum \"dolor\" sit amet"
Используйте обратную косую черту, как это
"This is \"text\" for"
new Tip('bio', "Lorem ipsum \"dolor\" sit amet.....
Используйте обратную косую черту \
избежать кавычек.