Find specific anchor href and add onclick function
<p>I have an anchor tag, I want when the user clicks it, it runs a function instead of  redirecting to another page. 
I cannot modify the tag directly instead I'm using JQuery, the only thing I can define is the <code>href</code> value, so here in my code I have set the <code>href</code> value to <code>tasks</code> and then in jquery I'm trying to find that specific anchor with <code>href=tasks</code> and add a <code>onclick</code> function to run the function <code>clickme</code></p>

<pre><code>$("a[href$='task']").onclick(clickme);

function clickme(){
alert("Hi");
return false;
}
</code></pre>

<p>However, I get this error message in <a href="https://jsfiddle.net/2qLcgfLm/2/" rel="nofollow">jsfiddle here.</a> </p>

<p><code>{"error": "Please use POST request"}</code></p>