2

I'm using the following jQuery code to display tooltips in a .NET web application:

$(document).ready(function () {
  // Tooltip only Text
  $('.masterTooltip').hover(function () {
    // Hover over code
    var title = $(this).attr('title');
    $(this).data('tipText', title).removeAttr('title');
    $('<p class="tooltip"></p>')
    .text(title)
    .appendTo('body')
    .fadeIn('slow');
  }, function () {
    // Hover out code
    $(this).attr('title', $(this).data('tipText'));
    $('.tooltip').remove();
  }).click(function (e) {
    var mousex = e.pageX + 20; //Get X coordinates
    var mousey = e.pageY + 10; //Get Y coordinates
    $('.tooltip')
    .css({ top: mousey, left: mousex })
  });
});

The data being displayed with show tabs when I use char(9) in the SQL record but why won't it show newlines when I use char(10) + char(13)?

JQuery Tooltip

Tony Trozzo
  • 1,231
  • 6
  • 20
  • 34

1 Answers1

2

Neither tab (\t) nor new line (\n) are recognized HTML characters.

For tab you can use: &emsp; (you could also use: &#9;)

For new line, you need to use <br/> (replace your \n char with <br/>)

or you can put your pre-formatted text inside html pre tag:

Hooman Bahreini
  • 14,480
  • 11
  • 70
  • 137