JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://example.com/?p=51">Title</a>

JavaScript

$("a").on("click", function(e) {
    e.preventDefault();
    alert( $(this).attr("href").split("=")[1] );
});