ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
JavaScript和JQuery获取DIV的值: ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript和JQuery获取DIV的值</title> <script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script> </head> <body> <script type="text/javascript"> $(function(){ $("#jqueryInput").click(function(){ var divVal = $("#div_val").html(); console.log(divVal); alert(divVal); }); }); </script> <div id="div_val">test1</div> <input type="button" value="JQuery获取DIV的值" id="jqueryInput"/> </body> ```