hi
why '\n' character doesn't create line breaks when used inside title attribute?
something like this: <input title="line 1\nline 2\nline 3" type="radio">
newline character inside title attribute
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
You might need \r\n if you're on windows. You need to have a look at your source code to see what's appearing.
Real line breaks work though.
Real line breaks work though.
Code: Select all
<div title="line1
line2
line3
line4">Text here</div>firefox also doesn't display newlines.in both browsers is '\n' as is.
<input title="line 1\nline 2\nline 3" type="radio" name="date">
anyway i use ',' instead of '\n'. it is not that critical
the code is simply bunch of radio inputs having same name like theseYou need to have a look at your source code to see what's appearing.
<input title="line 1\nline 2\nline 3" type="radio" name="date">
anyway i use ',' instead of '\n'. it is not that critical
You need to use the HTML entitie in order to define new lines within the title attribute i.e.
(used PHP tags as the 'code' tags were stripping the entities)
However, while this works for most browsers, it does not render correctly in any Gecko based browser (i.e. Firefox or Mozilla). Personally I think that's down to Mozilla's misinterpretation of the spec but that's an entirely different debate/subject.
Code: Select all
title="Some line
A new line"However, while this works for most browsers, it does not render correctly in any Gecko based browser (i.e. Firefox or Mozilla). Personally I think that's down to Mozilla's misinterpretation of the spec but that's an entirely different debate/subject.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Yeah sorry I didn't realise you were referring to using \n directly as the output, I thought this was somewhere in the PHP code. SGML parsers won't parse escape sequences like such and they'll just parse them as plain text, in the same way as if you opened notepad in windows and typed the following then saved it.
Ascii entity codes are what SGML parsers use for this like ~redmonkey says.
Code: Select all
This is line one\nThis is line two