Here, in this article when i click on one textbox the corresponding text in this textbox hides, and as soon as i click on another textbox the first textbox text appears.
The following steps are required to make the above task possible
Step1: Download the jquery file from
http://code.jquery.com/jquery-1.6.3.min.js
Step 2: Add the following script under the head section
script type="text/javascript">
$(document).ready(function ()
{
$('.tab').focus(function () {
$(this).css('background', '');
});
$('.tab').blur(function () {
$(this).css('background', 'White');
});
$('.tab').focus(function (e) {
if ($(this).val() == $(this)[0].title) {
$(this).removeClass("defaulttext");
$(this).val("");
}
});
$('.tab').blur(function (e) {
if ($(this).val() == "") {
$(this).addClass("defaulttext");
$(this).val($(this)[0].title);
}
});
$('.tab').blur();
});
Step3: Create a form to check the script is working or not.
3.1: Create two textboxes and write default text under title tag
0 Comment(s)