0

Consider two strings:

name = "Hello"
mess = "Whats up"

Now to a tooltip class, I m trying to add an attr tag as follows:

$(this.el).find('.checkcalls').attr('title', "#{name}<br/>#{mess}")

This prints:

"Hello<br/>Whats up"

I do not want to print the break tag, rather execute it.

I've tried:

  $(this.el).find('.checkcalls').attr('title', '#{name}<br/>#{mess}')

and:

 $(this.el).find('.checkcalls').attr('title', '"#{name}"<br/>"#{mess}"')

They don't print the desired result.

How can I achieve this?

T J
  • 42,762
  • 13
  • 83
  • 138
Mahesh Mesta
  • 793
  • 1
  • 11
  • 28

1 Answers1

0

Don't use br - use \n instead:

$(this.el).find('.checkcalls').attr('title', '"#{name}"\n"#{mess}"');

I don't know backbone, but this should work.

Edit:

Found the answer here, and it's true - it's so simple! Just add an actual, press-the-enter-key linebreak!

$(this.el).find('.checkcalls').attr('title', '"#{name}
#{mess}"');
Community
  • 1
  • 1
Jack Bashford
  • 43,180
  • 11
  • 50
  • 79