Home > Web Front-end > JS Tutorial > body text

jquery implements non-overlapping search box prompt effect_jquery

WBOY
Release: 2016-05-16 17:04:53
Original
1102 people have browsed it

I have been using JQUERY to superimpose two INPUT boxes to realize the user name and password that need to be entered during login to realize prompts and user output. Here I use JQUERY to achieve this effect in an INPUT box. The specific method is:

The following is the INPUT box code:

Copy the code The code is as follows:



The following is the JQUERY code:
Copy code The code is as follows:

//Set the default value of search
$(".search_text").focus(function(){
if($(".search_text").val()=='search'){
$(".search_text").val("");
} else{
$(".search_text").val($(".search_text").val());
}
});
$(".search_text").blur(function(){
if($(".search_text").val()==''){
$(".search_text").val("search");
}else{
< ;span style="white-space:pre">
$(".search_text").val($(".search_text").val());
}
});

I won’t adjust the format. After all, it’s not an IDE editor used in programming. If you are interested, you can take a look!
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template