<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>div,input, set,get value </title> <meta name="Description" content="geovindu"/> <meta name="Keywords" content="geovindu"/> <meta name="author" content="geovindu"/> <script src="ajax/libs/modernizr/2.8.3/modernizr.min.js" type="text/javascript"></script> <script src="bootstrap/4.6.2/js/bootstrap.min.js" type="text/javascript"></script> <link rel="stylesheet" href="bootstrap/4.6.2/css/bootstrap.min.css"> <script src="js/jquery-3.6.0.js"></script> <script type="text/javascript" src="assets/js/DuSize.js"></script> <link rel="stylesheet" href="css/main.css"> </head> <body> <textarea id="txtMessage" class="txtMessage" name="txtMessage" ></textarea> <div class="emojionearea-editor" contenteditable="true" placeholder="" tabindex="0" dir="ltr" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off">geovindu,涂聚文</div> <div class="input-group" style="float: right;"> <input class="form-control" style="visibility: hidden;" /> <span class="input-group-btn"> <input type="button" class="btn btn-primary btn-flat" id="btnSendMsg" value="send" /> </span> </div> <script type="text/javascript"> const textarea = document.getElementById('txtMessage'); var geovinduhtml = $('.emojionearea-editor').html(); $(function () { $('#btnSendMsg').click(function () { var msg=$("#txtMessage").val(); alert(msg); console.log("MSG:"+textarea.value); console.log("MSG:"+msg) console.log("div:"+geovinduhtml) textarea.value = ""; $("#txtMessage").val(""); $(".emojionearea-editor").html(""); console.log("msg:"+textarea.value) }); }); </script> </body> </html>
标签:set,console,log,textarea,get,value,msg,div From: https://www.cnblogs.com/geovindu/p/17066099.html