Is it possible to use an input value attribute as a CSS selector?

后端 未结 9 2311
[愿得一人]
[愿得一人] 2020-11-27 17:07

Is it possible to use a CSS selector to target an input that has a specific value?

Example: How can I target the input below based on the value=\"United States

9条回答
  •  一向
    一向 (楼主)
    2020-11-27 17:23

    Refreshing attribute on events is a better approach than scanning value every tenth of a second...

    http://jsfiddle.net/yqdcsqzz/3/

    inputElement.onchange = function()
    {
        this.setAttribute('value', this.value);
    };
    
    inputElement.onkeyup = function()
    {
        this.setAttribute('value', this.value);
    };
    

提交回复
热议问题