Home >Web Front-end >JS Tutorial >jquery implements non-overlapping search box prompt effect_jquery

jquery implements non-overlapping search box prompt effect_jquery

WBOY
WBOYOriginal
2016-05-16 17:04:531119browse

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!
Statement:
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