Prevent globalised anchor in a jstree node?

Viewed 17

Google is not my friend today. I want to add a node with unanchored text in it. The input looks like follows:

<ul>
  <li><span>(required)</span><a href="example.com">toexample</a></li>
</ul>

Now if I load jstree on that, the whole li content is put into one anchor tag, and the span completely disappears.

<li role="none" id="j1_4" class="jstree-node  jstree-leaf">
  <i class="jstree-icon jstree-ocl" role="presentation"></i>
  <a class="jstree-anchor" href="example.com" tabindex="-1" role="treeitem" aria-selected="false" aria-level="4" id="j1_4_anchor">
  <i class="jstree-icon jstree-themeicon" role="presentation"></i>
  toexample
  </a>
</li>

I am looking for a way so jstree just shows what I deliver to it. The '(required)' text shall be outside of the anchor tag and be plain text. I am pretty new to jstree so any advice is appreciated!

$('#jstree').jstree();
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>

<div id="jstree">
<ul>
  <li><span>(required)</span><a href="example.com">toexample</a></li>
</ul>
</div>

0 Answers
Related