<div class="parent"> <a class="cld1">1</a> <a class="cld2">2</a> <a class="cld3" >3</a> <a class="cld4" >4</a> </div>
How to insert any element between the children second and third anchor tag?
$('//div[@class="parent"]/a[@class="cld2"]') { insert_after('div','hii') }
You can do like this to inset div in between tag Refer http://tester.tritium.io/18f12697fde014066894af356915af1471782732
Another way to do this if you want to target the number instead of the class is like so:
$('//div[@class="parent"]/a[contains(text(),"2")]') { insert_after('div', class:'example') }
Another way of doing this is:
$('//div[@class="parent"]/a[position()=2]') { insert_after('div','Hello', class:'test') }
This way we need not to worry about enter code here the class change or text change also.
Copyright © 2021 Jogjafile Inc.
You can do like this to inset div in between tag Refer http://tester.tritium.io/18f12697fde014066894af356915af1471782732