This can be done in CSS without jQuery:
a:active { background-color: black; }
Android Browser Compatibility Note
For some reason, the code above does not work in the Android Android browser (and possibly in some other browsers). However, it will work after adding the ontouchstart="" argument to the <body> as follows:
<body ontouchstart="">
In addition, the Android Android browser highlights the default links (with a blue background on my phone). To disable this, enter:
a { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
See and for details.
source share