JSFiddle - React, Tailwind, and code Playground

HTML

<ul class="multilevel">
<li><p class="level">item 1</p></li>
<li><p class="level">item 2</p></li>
<li><p class="level">item 3</p></li>
</ul>

JavaScript

$(document).on("click", ".multilevel p.level", function(e) {
		var box = $(this).next(".itemMenuBox"); // box you want to interact with

		// if box does not exist, add it!
		if( !box.length ) {
			alert('not found, add it!');
   
			var box = $("<div></div>")
				.attr("class", 'itemMenuBox').text('new box')
				.appendTo($(this));
		} else {
			alert('found box');
		}
	});