I’m using CodeRay to generate html code and almost all text elements wrapped in span but some of them didn’t. In the example you can see that primary_key_prefix_type doesn’t wrap in at all.
<span class="no">1172</span><span class="r">case</span> primary_key_prefix_type
<span class="no">1173</span><span class="r">when</span> <span class="sy">:table_name</span>
But I need to iterate through all elements by using next() and prev() functions from jQuery.
Therefore I’m missing the primary_key_prefix_type because it’s not an element for jQuery. How to ‘see’ all elements? Thanks.
You can use
.contents()which includes text nodes as well.Example on jsfiddle
Update
.nextSiblingwill get the next element regardless if it is an element or a text node.Example on jsfiddle