title: Add event when click at some place
body: <p>I'm working on a simple admin system. Now I want to make it easier for admin to edit data. My goal is, when an element is double-clicked, it will change to input. Then after editing, if the admin clicks outside of the input, it runs an event to run ajax. It is like the system in PHPMyAdmin, when we want to edit data, just double click at the data.</p>
  <p>HTML</p>
  <pre><code>&lt;tbody&gt;
      &lt;tr&gt;
          &lt;th scope=&quot;row&quot;&gt;1&lt;/th&gt;
          &lt;td class=&quot;editable&quot; name=&quot;email&quot;&gt;myname@myweb.com&lt;/td&gt;
          &lt;td class=&quot;editable&quot; name=&quot;username&quot;&gt;this_is_username&lt;/td&gt;
          &lt;td class=&quot;editable&quot; name=&quot;name&quot;&gt;My Name&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  <p>JavaScript</p>
  <pre><code>$(&quot;.editable&quot;).dblclick(function () {
      const id = $(this).data(&quot;id&quot;);
      const col = $(this).attr(&quot;name&quot;);
      $(this).html(
          &quot;&lt;form&gt;
               &lt;input class=&quot;editing&quot; type='text' value='&quot; + $(this).val() + &quot;'&gt;
          &lt;/form&gt;&quot;
      );
  });
  
  // I want this Ajax will execute whene other side is clicked
  
  $.ajax({
          url: &quot;http://localhost/myProject/myController/myMethod&quot;,
          type: &quot;post&quot;,
          data: {
              id: id,
              col: col,
              value: $('.editing').val()
          },
          success: function () {
              document.location.href = &quot;http://localhost/myProject/myController&quot;;
          },
      });
  </code></pre>
  <p>Controller</p>
  <pre><code>public function myMethod()
  {
      $id = $this-&gt;input-&gt;post(&quot;id&quot;);
      $col = $this-&gt;input-&gt;post(&quot;col&quot;);
      $value = $this-&gt;input-&gt;post(&quot;value&quot;);
      $this-&gt;db-&gt;set($col, $val);
      $this-&gt;db-&gt;where('id', $id);
      $this-&gt;db-&gt;update(&quot;my_table&quot;);
  }
  </code></pre>
  <p>But I do not know how to make an event to execute Ajax when admin click outside of the input. Anybody can help me? Or there are function have been made?</p>
  <p>***Note: I want to exclude it on tag anchor. So, when some link is pressed, it does not execute the Ajax, but go to the link.</p>