[Solved] Show value on title from clicked item with jQuery


ID of an element must be unique, so need to use class to group similar elements, also in the click handler you need to find the title element which is a descendant of the clicked li

jQuery('#restaurant-menu-content-tab').on('click', '#res-menu-filters li', function(e) {
  var value = jQuery(this).find('.menu-extend-title').text();
  jQuery('#menu-title-layout-text').text(value);
  return false;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="restaurant-menu-content-tab">
  <div class="menu-title-layout-change">
    <h3 id="menu-title-layout-text">Breakfast</h3>
  </div>
  <ul id="res-menu-filters">
    <li class="filter">Category 1
      <div class="menu-extend-title">Breakfast</div>
    </li>
    <li class="filter">Category 2
      <div class="menu-extend-title">Launch</div>
    </li>
    <li class="filter">Category 3
      <div class="menu-extend-title">Dinner</div>
    </li>
  </ul>
</div>

0

solved Show value on title from clicked item with jQuery