0

This may be a silly question, but some websites, depending where my cursor currently is, when I select all (ctrl+a), it selects only a portion of the page.

Obviously, I understand how this works for <input> or <textarea> elements. But is there a simple way to control the behavior of that select all?

I understand I can capture key events, etc. but I just wondering if there is a HTML built-in attribute or behavior.

Eric Liprandi
  • 5,324
  • 2
  • 49
  • 68
  • 1
    Maybe the css property: `user-select: none` would be what you're looking for. – AskYous Mar 05 '20 at 22:14
  • interesting @AskYous , I didn't know about that CSS property. However, that's not really what I want. At least I don't think or I don't understand how to use it. When I am in a `` element and hit `ctrl+a`, it selects the whole input. I was just editing a bug in Jira and noticed that their advanced editor allowed me to hit `ctrl+a` inside a code block and it would only select the code block. As far as I can tell, there are no `` or ` – Eric Liprandi Mar 05 '20 at 22:27
  • 1
    https://stackoverflow.com/questions/24553251/is-it-possible-to-restrict-the-range-of-select-all-ctrla – Train Mar 05 '20 at 22:34
  • 1
    The first comment for the accepted answer has what you're looking for. – Train Mar 05 '20 at 22:35
  • @Train thanks for the pointer. That's exactly what I was looking for. Of course, that's also exactly what I was afraid of: it's not that simple. Thanks for the info. I'll keep it tucked for future use. – Eric Liprandi Mar 05 '20 at 22:47

0 Answers0