title: using confirm alert box in js inside another function
body: <p>I had a confirmation box that showed a confirmation alert when clicking on the delete button,</p>
  
  <p>heres the function</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('.confirm').on('click', function () {
          return confirm('Are you sure you want to delete ?');
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>it was working fine whenever i put a class for any html element, until i added it inside this function it stopped working</p>
  
  <pre><code>$(document).ready(function() {
    $('#list').dataTable({
      "ajax":{
            url :"list.php",
            type: "GET",
            error: function(){
              $("#post_list_processing").css("display","none");
            }
          },
          "columns": [
                { "data": "title" },
                { "data": "description" },
                {
                  "data": function(item) {
                    return '&lt;a class="confirm" href="delete.php?id=' + item.id + '"&gt;delete&lt;/i&gt;&lt;/a&gt;';
                  }
                }
            ]
    });
  });
  </code></pre>