I have a code below $(‘#tree’).on(‘select’, function (e, node, id) after clicking on a Menu.
I want to know the same trigger on right click,
I want to know the equivalent of this command $(‘#tree’).on(‘select’, function (e, node, id)
on right click and not on click
Thanks for the help!
$(document).ready(function () { var tree = $('#tree').tree({ primaryKey: 'id', uiLibrary: 'bootstrap4', iconsLibrary: 'fontawesome', dataSource: testURL, checkboxes: false, dataBound: function (e) { } }); $('#tree').on('select', function (e, node, id) { var data, frame; data = tree.getDataById (id); frame = document.getElementById ('screen'); if (data.url.length > 0) { frame.src = data.url; setTimeout(function() { $('#menu').trigger('click'); }, 1000); $("#wrapper")[0].scrollIntoView(); } });
I tried below but it isn’t working
$(document).ready(function () { var tree = $('#tree').tree({ primaryKey: 'id', uiLibrary: 'bootstrap4', iconsLibrary: 'fontawesome', dataSource: testURL, checkboxes: false, dataBound: function (e) { } }); $('#tree').on('select', function (e, node, id) { var data, frame; data = tree.getDataById (id); frame = document.getElementById ('screen'); if (data.url.length > 0) { frame.src = data.url; setTimeout(function() { $('#menu').trigger({ type: 'mousedown', which: 3 }); }, 1000); $("#wrapper")[0].scrollIntoView(); } });
Allan Morris Caras is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.