JSFiddle - React, Tailwind, and code Playground

by db_dev

HTML

<button id="toggleTreeNodes" class="btn btn-dark btn-sm" type="button" title="Collapse All/Expand All">
													Collapse All
												</button>

JavaScript

$("#toggleTreeNodes").on("click",
	function () {
		if ($(this).text() == "Collapse All") {
			//$('#decisionTree').jstree('close_all');
			$(this).text("Expand All");
		}
		else {
			//$('#decisionTree').jstree('open_all');
			$(this).text("Collapse All");
			
		}
	});