user1217380
user1217380

Reputation: 629

jquery textbox value not showing in IE9

Works great in all other browsers except IE9.Is there any fix?Have tried .attr("value") as well but it still does not work.

$searchbox.focus(function(e){  
        $(this).val("");  
});  
$searchbox.blur(function(e){  
      if($(this).val()=="")
           $(this).attr("value","Search For Music...");

}); 

Upvotes: 0

Views: 596

Answers (1)

Mujah Maskey
Mujah Maskey

Reputation: 8804

$searchbox.focus(function(e){  
        $(this).val("");  
});  
$searchbox.blur(function(e){  
      if($(this).val(""))
           $(this).val("Search For Music...");

}); 

did you check like this?

but you want to clear text on focus and add text "Search For Music" if blank text, if so you can do like

$searchbox.focus(function(e){ 
    if($(this).val() == "Search For Music...")
        $(this).val("");  
});  
$searchbox.blur(function(e){  
      if($(this).val() == "")
           $(this).val("Search For Music...");

}); 

Upvotes: 2

Related Questions