/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// // Search form control function // $(document).ready(function(){ // Get default search box value from hidden label $("#keywords").attr("value", $("#search label").text()); // Clear search box only if default value present $("#keywords").focus(function(){ if ($(this).attr("value") == $("#search label").text()) { $(this).attr("value", ""); } }); });