Jquery Form Field Value May 09, 2024 Post a Comment How can I the HTML string from this HTML FORM pass to the DIV using Jquery? HTML FORM is: Solution 1: Here is an example from learningjquery.com$(document).ready(function() { $('#comment').one('focus',function() { $('#comment').parent().after('<div id="preview-box"><div class="comment-by">Live Comment Preview</div><div id="live-preview"></div></div>'); }); var $comment = ''; // that's two single quotation-marks at the end $('#comment').keyup(function() { $comment = $(this).val(); $comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br /><br />').replace(/(<\/?)script/g,"$1noscript"); $('#live-preview').html( $comment ); }); }); CopyWhich is very close of what you are trying to do. Solution 2: First, as durilai commented, there is no div with an ID of wall, which means that even if your submit handler is working, append isn't going to append since there's nothing to append to.Baca JugaPhp Not Inserting Content In Mysql Database: Text, Images, AnythingAdd Div With Dynamic Vergejs Viewport Values To HtmlAdd Div With Dynamic Vergejs Viewport Values To HtmlSecond, even though you said action="" on the form, the form will still submit and cause what looks like a page reload because you are not preventing the default action in your submit handler. One quick fix is to add return false; as the last line of the handler. Another fix is to rewrite it like:$("form#submit_wall").submit(function(event) { event.preventDefault(); $("div#wall").append("<div class='msg'>"+ $("#message_wall").val() + "</div>"); }); Copy Share You may like these postsWhy Differences There In .html File On Local Host And .html File Uploaded On Web?How Would I Detect Touch Screens In Jquery And Hide A DivIs My Understanding Of Webrtc Protocol Correct?Use Of Php Include In Html Files Post a Comment for "Jquery Form Field Value"
Post a Comment for "Jquery Form Field Value"