如何在按钮点击时显示文本区域? [英] how to show text area on button click?

查看:115
本文介绍了如何在按钮点击时显示文本区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

</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>

如何在点击按钮上弹出文本区域?

How to POPUP a text area on a button click?

推荐答案

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

   // To show it
   textarea.show();

});

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

这篇关于如何在按钮点击时显示文本区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆