0

I want to display an image with a title and an alt attribute. They both display the same content which is stored in a variable. Before displaying I replace all occurences of "\n" with " ". Now the interesting part: When hovering over the image, the title displays the text correctly (sentence under sentence) but the alt text shows " " instead of breaking the lines.

What the heck is going on? O_o

Thanks for your help!

EDIT:

        ...
        tooltipText = tooltipText.replaceAll("\n", "
");
        startElement(HTML.IMG_ELEM, someName);
        writeAttribute(HTML.TITLE_ATTR, tooltipText);
        writeAttribute(HTML.ALT_ATTR, tooltipText);
        ...
user1323246
  • 433
  • 2
  • 6
  • 23
  • where do you replace that using what? code would be usefull – Jenson Aug 02 '12 at 14:44
  • you shouldn't expect to have full control over the title and alt text. I don't think the lines they contain are meant to be breaked – Razvan Aug 02 '12 at 14:47

1 Answers1

0

I googled around and found this other question on Stack Overflow that may help you: newline in <td title="">

edit - tested on Firefox 14.0.1 (Ubuntu). Can't test with IE8, though.

Community
  • 1
  • 1
orique
  • 1,295
  • 1
  • 27
  • 36