How to remove/change <sp-date-picker> tooltip

jpeterson4
Tera Contributor

Hello, I've created a <sp-date-picker> using most of the code from this: Solved: Re: Date Picker in widget is not showing correct d... - ServiceNow Community

The problem is that the calendar has a hover over tooltip that reads "Show Calendar for {0}". How do I get rid of this entirely or change it to say something else?

 

tooltip.png

1 ACCEPTED SOLUTION

Vaibhav127
Tera Guru

Hi jpeterson4,

 

you can use jquery to change the title.

$(document).on('mouseenter', "button[aria-label='Show Calendar for {0}']", function() {
$("button[aria-label='Show Calendar for {0}']").attr('title', 'NEW_TITLE').tooltip('fixTitle').tooltip('show');
});

View solution in original post

7 REPLIES 7

Hi @jpeterson4 @Nguyen Vuong Ph @Vaibhav127 @

Can you tell me where I can write the jQuery code?

 

Thank you 

Ramji

You would put this into the client script within the widget that has the directive you are looking to adjust.

OliverDoesereck
Tera Guru

Please do not use DOM manipulation as this is not best, or even good practice.

You can find the angular module here: <yourinstance>.service-now.com/scripts/app.$sp/directive.spDatePicker.js

Here you can see, the {0} is replaced by scope.field.label

In your HTML of sp-date-picker, you have a property called field (usually an angular object, the example its c.fromDate). If you give the c.fromDate object the label property, you can control whats entered in {0}