开发者

.serialize contentEditable div?

开发者 https://www.devze.com 2023-03-06 04:44 出处:网络
I\'m using (form).serialize to POST a form with ajax... Something l开发者_JAVA百科ike: $.post(\"/ajax/post_message_action.php\", $(form).serialize(), function (data) { ... }

I'm using (form).serialize to POST a form with ajax...

Something l开发者_JAVA百科ike:

    $.post("/ajax/post_message_action.php", $(form).serialize(), function (data) { ... }

The problem is that I want to use a contentEditable DIV instead of a

<textarea name="description">

Is this possible?

Thanks!


$.post("/ajax/post_message_action.php",
    $(form).serialize()+"&description="+$('div[name=description]').text() ,
function (data) { ... });


a. keep a hidden textarea element in the form.
b. on form submit, set the innerHTML of the div as the text in the textarea.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号