textarea::selection and ::-moz-selection

后端 未结 2 1525
北海茫月
北海茫月 2020-12-16 20:52

Is there a way to apply the ::selection and ::-moz-selection CSS pseudo-elements to the text inside a textarea?

textarea::selection         


        
2条回答
  •  不思量自难忘°
    2020-12-16 21:37

    Updated as you said here, I'll update this question too:

    I disagree. It is working ;)
    Tested on Firefox 4.0b6

    I can confirm the following code works at least under Firefox 4.0b6 (Taken from my own answer)

    
    
    
    
    Test
    
    
    
    
    

    This paragraph is selection-aware.

    It may not be wroking programmatically, if you are not careful with what you are doing. Maybe you are trying to select something with jQuery.select() and you are selecting the textarea object instead of its content.

提交回复
热议问题