There's nothing special about a <code> tag. It acts the same, for these purposes, as a <div> or <p> or <span> tag. In no way does it resemble an <input> or <textarea> form field.
If you wanted to use JS code to "hightlight" the text in any of those, you would have to put the desired text in, say, a <span> and apply a style to that <span>.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.