• Resolved wisam-mo

    (@wisam-mo)


    hi,
    I want to show a post_custom field data into a float ‘div’ using javascript by the method ‘ShowMsg’ so I write:
    onmousemove="ShowTooltip('<?php echo str_replace("\n","<br />",htmlspecialchars(post_custom('tooltip'))) ?>')"

    but there still be a line that break the text… so it look like…

    onmousemove="ShowTooltip('hi,
    how are you')"

    the text shown in 2 lines so JavaScript got an error…
    for more info the main text is always written in utf-8 arabic…

    can you help me solving the problem…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wisam-mo

    (@wisam-mo)

    I resolved it by next new code:
    onmousemove="ShowTooltip('<?php echo str_replace("\r\n","<br />",htmlspecialchars(post_custom('tooltip'))) ?>')"

    I add \r before \n

    Thread Starter wisam-mo

    (@wisam-mo)

    or I can use nl2br()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tiny problem with post_content & php (how to remove \n )’ is closed to new replies.