Table of Contents
1. Click the input input box to enlarge and shrink the js code
Home Web Front-end JS Tutorial js realizes the input box to be enlarged and reduced when clicked

js realizes the input box to be enlarged and reduced when clicked

Mar 07, 2018 pm 05:07 PM
input javascript

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.

1. Click the input input box to enlarge and shrink the js code

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>
Copy after login

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"
		})
	});
});
Copy after login

Related recommendations:

Javascript code implements the fuzzy prompt function of the input input box

JS implements an example of clicking the drop-down menu to synchronize the selected content to 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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to implement an online speech recognition system using WebSocket and JavaScript

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

How to use JavaScript and WebSocket to implement a real-time online ordering system

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

Simple JavaScript Tutorial: How to Get HTTP Status Code

How to get HTTP status code in JavaScript the easy way How to get HTTP status code in JavaScript the easy way Jan 05, 2024 pm 01:37 PM

How to get HTTP status code in JavaScript the easy way

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

How to use insertBefore in javascript

See all articles