Trying to get the child of a parent through a child accessor. Basically trying to get the .block__id through the add__block class. HTML
<div class="col-12"> <span class="block__id">{{$block->id}}</span> {{$block->title}} <span class="add__block">+</span> </div>
Jquery
$(".add__block").click(function(){ $(this).parent().find(function(){ var id = $(".block__id").text(); }); console.log(id); });
Currently I get id not defined.
#javascript #html #jquery