Overide Closemodal in custom widget

Dinesh61
Tera Contributor

Hi Community,

Can we override the "close modal" to close?

 

Dinesh61_0-1736409583133.png

 

 

2 REPLIES 2

Bhavya11
Kilo Patron

Hi @Dinesh61 ,

 

i have try this way it worked. Please follow this step

 

in client controller where your calling spModal just make little bit modification. if your using alert then this tooltip will be appeared try to use open method with an options 

function(spModal) {
    var c = this;
	

  c.onAlert = function () {
		
			var options = {
	title: '',
	message: '<h1 class="modal-title h4">Hi BK</h1>',
	input: false,
	keyboard: false,
	noDismiss: true, // this also hides the normal "title"
	buttons: [
		{label:'${OK}', primary: true}
	]
};
        spModal.open(options).then(function (answer) {
            c.simple = answer;
        });
    }
 }

 

output look like this:

Bhavya11_0-1737122747433.png

 

If this helped please like and mark it as an accepted solution. 

 

Thanks,

BK

 

Dinesh61
Tera Contributor

Hi @Bhavya11,

write the below code in widget client script to change the OOB label "closemodal" to "close", it worked for me

setTimeout(function() {
 var button = document.querySelector('button');
button.removeAttribute('title');
button.setAttribute('data-original-title','Close');
 }, 0);