gpt4 book ai didi

javascript - 如何在单击按钮时显示文本区域?

转载 作者:搜寻专家 更新时间:2023-11-01 05:26:26 25 4
gpt4 key购买 nike

</html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#popup").click(function(){
// pop up a text area and I want to store value of textarea in a variable.
});
});
</script>
</head>

<body>
<form>
<textarea rows="2" cols="20" id="area" style="display:none"></textarea>
<input type="submit" id="popup" value="OK">
</body>
</html>

如何在单击按钮时弹出文本区域?

最佳答案

var textarea = $('#area');
$("#popup").click(function(){

// To show it
textarea.show();

});

// To get the value
var value = textarea.val();

关于javascript - 如何在单击按钮时显示文本区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4814588/

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