DEV Community


Posted on

Show specific h5 tag

I have multiple data-id to a class. I need to select a particular h5 that ID matched a parent ID.



All that I am looking for is to select a specific h5 tag that data-id matches the Parent ID( var ParentID = $('#ddlSearch option:selected').val();) Then I can traverse the hierarchy from there.

$("#btn-search").click(function() {

  var ParentID = $('#ddlSearch option:selected').val();
  var selectedlastChild = $('.to-list).attr("data-id");  
  $('.list-container').each(function() {

    var delimiter = 'Id-';
    var ids =[1];
    if (ParentID(399) === ids(399)) {
      if(selectedlastChild(399) ==ParentID(399))
       show only <h5 class="to-list primary  data-id="399"> for example 
     and hide the rest


Enter fullscreen mode Exit fullscreen mode

Top comments (0)