php - Line breaks with javascript and HTML -
i have problem javascript , html. i'm using form user submits. if credentials wrong, script shows text message next input field.
message contains email want clickable.
things that:
when message string, ok.
when add <a href=\"mailto
tag, line breaks.
<div id="message_box"> <span id="msgbox" style="display:none"></span> </div>
ok:
$("#msgbox").fadeto(200,0.1,function() { var msg = ("ooops, number enterd not valid<br /> please contact: some@mail.com solve problem").replace(/[\r\n]/g, ''); $(this).html(msg).addclass('messageboxerror').fadeto(900,1); });
(edit)shows:
ooops, number enterd not valid
please contact: some@mail.com solve problem
not ok:
$("#msgbox").fadeto(200,0.1,function() { var msg = ("ooops, number enterd not valid<br /> please contact: <a href=\"mailto:some@mail.com\">some@mail.com</a> solve problem").replace(/[\r\n]/g, ''); $(this).html(msg).addclass('messageboxerror').fadeto(900,1); });
(edit)shows:
ooops, number enterd not valid
please contact:
some@mail.com
solve problem
the css:
#message_box { width:370px; height:30px; padding-top:15px; } .messagebox{ position:relative; width:100px; margin-left:0px; padding:290px; font-size:14px; color: #647a03; } .messageboxok{ position:relative; padding:0px; width:100px; color:#f00; font-size:10px; } .messageboxerror{ position:relative; width:100px; padding:0px; color:#cc0000; font-size:12px; }
can me remove these annoying linebreaks??
thanks!
from comments:
given complete css code requested several commenters, a
tag set display: block
. needs set inline
anchor tag.
w3c resources:
Comments
Post a Comment