Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not able change the default style of title attribute in input tag. But styles are affected for anchor tag. Kindly give me solution

What I have tried:

input {
color: #900;
text-decoration: none;
}

input:hover {
color: red;
position: relative;
}

input[title]:hover:after {
content: attr(title);
padding: 4px 8px;
color: #333;
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 20px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #222;
-webkit-box-shadow: 0px 0px 4px #222;
box-shadow: 0px 0px 4px #222;
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
}
Posted
Updated 11-Sep-20 1:37am

1 solution

No. But you may try some trick with it.

$(document).ready(function(){
  var old_title;
  $('.title-styled').on('mouseover', function(){
    old_title = $(this).attr('title');
    $('.title-message').html($(this).attr('title')).css('visibility', 'visible');
    
    $(this).attr('title', '');
  });
  
  $('.title-styled').on('mouseleave', function(){
    $(this).attr('title', old_title);
    $('.title-message').html('').css('visibility', 'hidden');
  });
  
});


.title-message{
  visibility: hidden;
  padding: 10px;
  border: solid 1px #f9f9f9;
  box-shadow: 3px 3px 3px #1a1a1a;
}


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type= "submit" id="submit" class="title-styled" title= "submit your form">

<span class="title-message"></span>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900