I'm getting the content using $(this).html()
, this works fine in Chrome and Firefox as I get newlines, but in IE I don't get newlines. Why is this? I need newlines for markdown to work.
This is how it looks in the db (using MySQL Workbench):
This is how it looks like when I alert the content from $(this).html()
in...
... Chrome:
... IE(8):
I tried outputting it in the console but same thing there, newlines in Chrome but not in IE(8). How can I get newlines with IE?
I fetch data (with ajax) and put it in a div and then loop all new entries in that div and converts it to markdown.
IE normally uses \r\n
for newlines, try that instead of just \n
!
Also, jQuery states the following : Due to variations in the HTML parsers in different browsers, the text returned from html() may vary in newlines and other white space.
jQuery text() is often a better option for escaped characters, and sometimes even double escaping will be necessary.
According to this link a \r
should work.
And according to this link a \n
should work
Have you tried both options?
Have you considered a jQuery modal popup (dialog)? then you have more style options and cross browser compatibility
\n
Should work you can check for the User agent if it is Chrome or Mozilla try using Jquery Flash or