Skip to content

Instantly share code, notes, and snippets.

Created July 27, 2012 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/dc59408990ebbf17f2d6 to your computer and use it in GitHub Desktop.
Save anonymous/dc59408990ebbf17f2d6 to your computer and use it in GitHub Desktop.
<HTML>
<HEAD>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="jquery.clearable.js"></script>
<link rel="stylesheet" href="jquery.clearable.css" type="text/css" media="screen" />
<script>
$(document).ready(function(){
$("#search").on("keyup", function() {
if ($(this).val().length > 0){
$('.divclearable').show();
$('#search').clearable();
}
else{
$('.divclearable').hide();
}
});
});
</script>
<TITLE>Clearable Textboxes in jQuery</TITLE>
<STYLE>
body, input{
font-family: Calibri, Arial;
margin: 0px;
padding: 0px;
}
input {
font-size: 15px;
}
.style1 {
border: 3px solid #ffaa00;
font-size: 20px;
}
</STYLE>
</HEAD>
<BODY>
<div id="container">
<div id="header">
<H2>Clearable Textboxes in jQuery</H2>
</div>
<div id="content">
<br/>
<input type="text" class="clearable style1" size="30" id="search" />
</div>
</div>
</BODY>
</HTML>
<HTML>
<HEAD>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="jquery.clearable.js"></script>
<link rel="stylesheet" href="jquery.clearable.css" type="text/css" media="screen" />
<script>
$(document).ready(function(){
$("#search").on("keyup", function() {
if ($('#search').val().length != 0){
$('#search').clearable();
$('.divclearable').show();
}
else{
$('.divclearable').hide();
}
}
});
</script>
<SCRIPT>
$(document).ready(function() {
//$('.clearable').clearable()
});
</SCRIPT>
<TITLE>Clearable Textboxes in jQuery</TITLE>
<STYLE>
body, input{
font-family: Calibri, Arial;
margin: 0px;
padding: 0px;
}
input {
font-size: 15px;
}
.style1 {
border: 3px solid #ffaa00;
font-size: 20px;
}
</STYLE>
</HEAD>
<BODY>
<div id="container">
<div id="header">
<H2>Clearable Textboxes in jQuery</H2>
</div>
<div id="content">
<br/>
<input type="text" class="clearable style1" size="30" id="search"></input>
</div>
</div>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment