Use php to pass multiline text to javascript

0

I would like to pass a text with multiple in a Javascript function that is mounted in PHP.

public function change_meta_info_icon($property)
    {
        if($property['metas'] && $property['metas']['socialdb_property_help'] && !empty(trim($property['metas']['socialdb_property_help']))){
            ?>
                <button onclick="showHelpText('<?php  echo ($property['metas']['socialdb_property_help']) ?>');" class="btn btn-default btn-xs">Ajuda</button>
            <?php
        }
        ?>
        <?php

    }

The showHelpText function should receive the text and pass it to a modal window but as the text has '\ n', parentheses, quotation marks, and everything else is generating problems.

    
asked by anonymous 10.11.2017 / 17:34

0 answers