This article mainly shares with you the js example code that realizes the input box to be enlarged and reduced by clicking on it. I hope it can help everyone.
html
<style type="text/css"> input[type='text'] { width: 100px; height: 30px; border-radius: 5px; } </style> </head> <body> <p> 标题:<input class="InputTitle" value="" type="text" /> </p> <!-- js响应"内容"输入框变大事件:src="/js/article/change_input.js" --> <p> 内容:<input class="InputContent" value="" type="text_content" /> </p>
js code
$(document).ready(function() { $("input[type='text_content']").focus(function() { $(this).animate({ "width" : "400px", "height" : "70px" }) }).blur(function() { $(this).animate({ "width" : "100px", "height" : "30px" }) }); });
Related recommendations:
Javascript code implements the fuzzy prompt function of the input input box
How to solve the problem of inconsistent cursor size display in the input input box
The above is the detailed content of js realizes the input box to be enlarged and reduced when clicked. For more information, please follow other related articles on the PHP Chinese website!