fopieltdipt
New Member
I use this jquery function to display a textbox hint this is function \[code\]function textboxHint(id, options) { var o = { selector: 'input:text[title]', blurClass:'blur' }; $e = $('#'+id); $.extend(true, o, options || {}); if ($e.is(':text')) { if (!$e.attr('title')) $e = null; } else { $e = $e.find(o.selector); } if ($e) { $e.each(function() { var $t = $(this); if ($.trim($t.val()).length == 0) { $t.val($t.attr('title')); } if ($t.val() == $t.attr('title')) { $t.addClass(o.blurClass); } else { $t.removeClass(o.blurClass); } $t.focus(function() { if ($.trim($t.val()) == $t.attr('title')) { $t.val(''); $t.removeClass(o.blurClass); } }).blur(function() { var val = $.trim($t.val()); if (val.length == 0 || val == $t.attr('title')) { $t.val($t.attr('title')); $t.addClass(o.blurClass); } }); // empty the text box on form submit $(this.form).submit(function(){ if ($.trim($t.val()) == $t.attr('title')) $t.val(''); }); }); }}\[/code\]this is html\[code\]<form action="" method="" class="search" > <input type="text" name="search" class="text" title="Search Subjects..." id="block" /> <input type="submit" name="submit" value="http://stackoverflow.com/questions/13852626/Search" class="submit" /></form>\[/code\]I called function like this..\[code\]$(document).ready(function() { textboxHint("block");});\[/code\]This is working.. but the problem is now I need to use this function to display a hint in two different text box with two different Ids. Eg: Id = block1 and Id = block2 etc...Can anybody help me in modifying this function to do this?