How to hide option from Menu


how to hide ‘Send SMS’ from Menu.

frm.page.menu.find(‘li:contains(“Send SMS”)’).hide();

i used this, but its not working.

@anjalipv

cur_frm.page.menu.find(`[data-label="${encodeURIComponent('Send SMS')}"]`).closest('li').remove();

its not getting hidden…

@anjalipv added in client script ?

yes, i already added this into client script.

@anjalipv

on which client side event you have added this ?

i used this in both refresh and onload

share you code here @anjalipv

frappe.ui.form.on(‘Purchase Receipt’, {
refresh(frm) {
cur_frm.page.menu.find([data-label=“${encodeURIComponent(‘Send SMS’)}”]).closest(‘li’).remove();
},
onload(frm) {
cur_frm.page.menu.find([data-label=“${encodeURIComponent(‘Send SMS’)}”]).closest(‘li’).remove();
}
});

@anjalipv

Please copy the given code, it’s working

cur_frm.page.menu.find(`[data-label="${encodeURIComponent('Send SMS')}"]`).closest('li').remove();

there is type on your code

1 Like

jQuery won’t work in Client Script I think

@Antony_Praveenkumar It will, Working For me . The code given was tried and tested

1 Like