Hi Adrien,
Which specific menu item are you planning to add it to?
You can use WordPress filter – nav_menu_link_attributes. Reference: https://developer.wordpress.org/reference/hooks/nav_menu_link_attributes/
Sample code:
function add_class_to_non_top_level_menu_anchors( $atts, $item, $args, $depth ) {
$menu_items = array(34,395437);
if(in_array($item->ID, $menu_items)){
$atts['onClick'] = 'teGleap.open()st';
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'add_class_to_non_top_level_menu_anchors', 10, 4 );
This code adds your onClick attribute to Menu items with IDs 34 and 395437.
You may replace these values for your reference.
You can find the ID of a menu item by right-clicking on it, inspecting it, the going to the Elements tab. Example: https://share.getcloudapp.com/d5uybLEA