gpt4 book ai didi

javascript - 使用文本区域以多行显示文本

转载 作者:行者123 更新时间:2023-11-27 22:33:26 25 4
gpt4 key购买 nike

<分区>

我在 html 中使用文本区域标签,我必须在不同的行中打印成分,但即使使用回车键,当我将文本区域的值传递给变量并打印它时,它也会出现在一行中。

以下是我的代码片段:

<div data-role="fieldcontain">
<label for="name">Ingredients</label>
<textarea rows="4" cols="50" id="new_ingredients">

</textarea>
</div>

$( '#new_recipe' ).live( 'pagebeforeshow',function(event){
var temp1 = $("#new_ingredients").val();
$("#testing").text(temp1);
});

<div data-role="page" id="new_recipe">
<div class="content" id="testing" ></div>
</div>

请帮助我如何在用户按下回车键时获取不同行的数据。在此先感谢您。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com