使用 Jquery 检索文本区域中的 ID
我有这个代码
<textarea id="boh" name="boh" rows="4" cols="50">
god save the queen for <span id="godsq">2<span> times</textarea>
<input type="text" id="risultat">
我想找到值 2 并在以下情况下放入输入字段我单击按钮
我尝试了以下代码
$( "#button" ).click(function() {$("#risultat").val($("#godsq").text());} );
但它没有给我结果
I have this code
<textarea id="boh" name="boh" rows="4" cols="50">
god save the queen for <span id="godsq">2<span> times</textarea>
<input type="text" id="risultat">
<button id="button" type="button">Click Me!</button>
I'd Like to find the value 2 and put in the input fiedl when I click the button
I tried the following code
$( "#button" ).click(function() {$("#risultat").val($("#godsq").text());});
But it doesn't give to me result
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论