Answers for "tooltip enabled when css ellipsis"

CSS
0

text-overflow ellipsis hover tooltip css

label {
  text-overflow: ellipsis;
  overflow: hidden;
  display: inline-block;
  white-space: nowrap;
  width: 50px;
}
<label for="x" title="Long Long Long ............... Text">
Long Long Long ............... Text
</label>
Posted by: Guest on August-30-2021
0

html make tooltip avaible if text overflow

$('.mightOverflow').bind('mouseenter', function(){
    var $this = $(this);

    if(this.offsetWidth < this.scrollWidth && !$this.attr('title')){
        $this.attr('title', $this.text());
        //OR $this.attr('title', $this.val()); //If using input
    }
});
Posted by: Guest on November-03-2021

Browse Popular Code Answers by Language