Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取不到textarea的值??? 这个是同步异步造成的吗? #95

Closed
sumiaowen opened this issue May 22, 2015 · 2 comments
Closed

Comments

@sumiaowen
Copy link

$(function() {
var editor = editormd("editormd", {
path : "editor-md-master/lib/",
width:'90%',
height:'640',
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "editor-md-master/examples/php/upload.php",
saveHTMLToTextarea:true
});
$('#submit').click(function(){
console.log(editor.getMarkdown()) //获取值正常
console.log(editor.getHTML()) //获取不到值
console.log(editor.getPreviewedHTML()) //正常
return false;
})

});
@Wentong-Liu
Copy link

我也遇到了此问题,不仅我的获取不到,Sample 中的都获取不到。。。
Chrome, Sarafi 都是如此


看了下代码,问题是由于设置的是val()但获取的是html()造成的

1902行:this.htmlTextarea.val(newMarkdownDoc);
应改为:this.htmlTextarea.html(newMarkdownDoc);

2187行:return this.htmlTextarea.html();
改为: return this.htmlTextarea.val();

@pandao
Copy link
Owner

pandao commented Jun 2, 2015

@sumiaowen @Weston-Liu fixed @v1.4.5

@pandao pandao closed this as completed Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants