title: how to add click only on button
body: <p>I am using jquery to bind a click on a button. In this var testId i am getting the id of the button and var showmoreId is getting the id of a div but the problem is onclick binds with the li so when i click anywhere in li onclick is working but i want it to work on button click and i also want the id of the div on click but do not want li to work on click so what  can i do to fix it.</p>
  <pre><code>async function userData(userdata) {
      let newValue = &quot;&quot;; 
  
  userdata.forEach(max=&gt; { 
  let add =  `&lt;div class=&quot;rb-container&quot;&gt;
              &lt;ul class=&quot;rb&quot;&gt;
              &lt;li&gt;
              &lt;div&gt;
              &lt;p&gt;${max.name}&lt;/p&gt;
      
              &lt;div&gt;
              &lt;p&gt;${max.email}&lt;/p&gt;
              &lt;button id=&quot;showMoreLess_${max.id}&quot; data-order-id=&quot;${max.id}&quot;&gt;View More&lt;/button&gt;
              &lt;/div&gt;
                  
              &lt;div id=&quot;showme_${max.id}&quot; class=&quot;showBlock&quot; style=&quot;display:none&quot;;&gt;
      
              &lt;div&gt;
              &lt;div&gt;
              &lt;p&gt;Quantity:&lt;/p&gt;
              &lt;p&gt;${max.volume}&lt;/p&gt;
              &lt;/div&gt;
              &lt;div&gt;
              &lt;p&gt;${max.group_email}&lt;/p&gt;
              &lt;p&gt;Group_Email&lt;/p&gt;
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
              &lt;/div&gt;
              &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;`
  
  
   newValue += add ;
   let container = document.querySelector('.user-details');
      container.innerHTML = newValue;
  
  }
  
  $(document).ready(function() {
          $('.rb-container li').unbind('click');
  
          $('.rb-container li').on('click', function () { 
              var testId = $(this).find('button').attr('id');          
              var showmoreId = ($(this).find('div &gt; div').next().attr('id'));
              
              viewFullDetails(testId, showmoreId);
          });
  </code></pre>