How to set title attribute of a button using jquery
I want to assign ajax return data to the button title attribute on button hover, so I use $('#data_btn').title = html(returndata);
, in the below code, then it cannot show any output. Here #data_btn is the ID of the button element. Please help me.
$('#data_btn').hover(function(){
var val_d = $('#country').val() +"-"+ $('#city').val();
window.alert(val_d);
if(val_d != 0)
{
$.ajax({
type:'post',
url:'getdata.php',
data:{id:val_d},
cache:false,
success: function(returndata){
$('#data_btn').title = html(returndata);
//$('#data_btn').html(returndata);
}
});
}
})
+3
source to share
3 answers