javascript - jquery button value to title -


i have lot buttons on site value (the text of button) , each has, example bootstrap class of '.btn-default':

<input type="button" value="clear" class="form-control input-sm btn-default" onclick="doingsomethingelseetc();"> 

how might use jquery value of button , bind title attribute each button, if moused on button, you'd default browser tooltip containing string button value, etc..?

for example, gist of i'm asking:

$('.btn-default').attr('title', $(".btn-default").val()); 

i'm trying touch code little possible, etc..

thank you!

you can use each iterate each button , set titles.

$('.btn-default').each(function(i,obj){     $(obj).attr('title', $(obj).val()); }); 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -