开发者

how to show text area on button click?

开发者 https://www.devze.com 2023-02-07 04:11 出处:网络
</html> <head> <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/开发者_StackOverflowjquery.min.js\"></script>
</html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/开发者_StackOverflowjquery.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();


In jquery you can use $("#area").show() to display the element.


If you're using jQuery, use the show method:

$('#area').show();

You can also control the speed of the animation:

$('#area').show("slow");
$('#area').show("fast");

Or you can specify an exact time in milliseconds. Here's the official documentation:

jQuery Show

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号