JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="email" name="email" />
JavaScript
$.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
$('#email').one("click", function() {
$(this).val("@");
$(this).selectRange(0,0);
});