php - Jquery text issue in tinymcs -


i have simple issue,i have textarea assign text in jquery.this plain text line spaces etc.here example of text

brand new!!!  huge size of 3 bedroom apartment located in dubai marina orra tower rent  situated on high floor, overlooking gorgeous view of marina 

now when assign textarea,it same above.here code how assign

$("#description").val(val);//val above text 

now when apply tinymce,it become this

brand new!!! huge size of 3 bedroom apartment located in dubai marina orra tower rent situated on high floor, overlooking gorgeous view of marina 

spaces line breaks lost. here code tinymce

$().ready(function() {     $('#description').tinymce({         // location of tinymce script         script_url : 'application/views/tinymce/jscripts/tiny_mce/tiny_mce.js',         // general options         width : "830",         height: "300",         theme : "advanced",         theme_advanced_toolbar_align : "left",         theme_advanced_statusbar_location : "bottom",         theme_advanced_toolbar_location : "top",         theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,",         theme_advanced_buttons2 : "",         theme_advanced_buttons3 : "",         theme_advanced_buttons4 : "",         force_br_newlines : true,         force_p_newlines : false,         gecko_spellcheck : true,           forced_root_block : '', // needed 3.x          plugins : "paste"       }); }); 

why text disforms?fiddle

in jsfiddle attached tinymce after jquery. didn't work, i've fixed. http://jsfiddle.net/svs7x/3/

as see issue in comments right. core of trouble – \n newline symbol <br \> conversion. can replacing this:

$("#description").val(val) 

to this:

$("#description").val( val.replace( /\n/, '<br />' ) ); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -