document.querySelector('p').onfocus = function() { alert('фокус'); }
<p>текст</p>
You can, only first for p you need to set the tabindex :
p
tabindex
document.querySelector('p').onfocus = function() { console.log('фокус'); }
<p tabindex="-1">текст</p>
Source: https://ru.stackoverflow.com/questions/692686/More articles:Big problems loading tmx filesRecyclerview elements are not updated after calling notifyDataSetChangedErrors in html validatorThrows in the vector documentHow to finish the dynamic menu on React?200 OK instead of 404, how to fix or add else?How to change the height of a block depending on the change in height of two blocks aboveValues of each digit when changing the version [duplicate]How to disable the transition effect between the Activity?sending file to php curlAll Articles