I wanted to save the text inside a contenteditable div being pre
formatted. How would i get the pre
form of the text and not the text where \n
and \r
are ommitted?
$('#save').click(function(e) {
var id = "board_code";
var ce = $("<pre />").html($("#" + id).html());
if ($.browser.webkit)
ce.find("div").replaceWith(function() { return "\n" + this.innerHTML; });
if ($.browser.msie)
ce.find("p").replaceWith(function() { return this.innerHTML + "<br>"; });
if ($.browser.mozilla || $.browser.opera || $.browser.msie)
ce.find("br").replaceWith("\n");
alert( ce.text() );
});
http://jsfiddle.net/AD5q7/10/ this doesnt work
try string for contenteditable div
UPDATE: try the string by typing it. There maybe no problem when the string is pasted.
1
abc def
gh i
jkl
2
#include<iostream.h>
#include<conio.h>
int main(){
int grade, passingMark=75;
cout<<"Hi there, please enter your mark: ";
cin>>grade;
if( ((grade >= passingMark)||(grade==35)) && (grade<101)){
cout<<"\nPass!";
}
return 0;//15lines
}
The save file must be also formatted like this and not without \n\r removed. Im expecting that the alert should include \n