Topic: Changing text of a tooltip onclick

Dhanvi Desu free asked 4 years ago


Expected behavior I want the tooltip to change text on click to the newTitle

Actual behavior The text does not change

Resources (screenshots, code snippets etc.)## Heading ##

function copyEmail() { var toCopy = document.createElement("input");

document.body.appendChild(toCopy);

toCopy.setAttribute('value', "email@comp.com");
toCopy.select();

document.execCommand('copy');
document.body.removeChild(toCopy);

//trying to get tooltip text to change
var tool = document.getElementById("email");
tool.setAttribute('title', "Copied: email");
$(element).attr('title', 'NEW_TITLE')
    .tooltip('fixTitle')
    .tooltip('show');

}


Krzysztof Wilk staff commented 4 years ago

Hi!

Could you make a snippet with your problem using our online editor (you can find it here https://mdbootstrap.com/snippets/) and share the link to it with me? It'll be very helpful :)

Best regards



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: Macbook Pro
  • Browser: Chrome
  • OS: MacOS Catalina
  • Provided sample code: No
  • Provided link: No