Spellcheck disable with CSS not HTML

前端 未结 2 797
广开言路
广开言路 2021-01-04 00:31

I want to disable spellchecking in Chrome/Safari using CSS. In HTML spellcheck=\"false\" works but I want to do this in a way that will affect all input fields.

2条回答
  •  别那么骄傲
    2021-01-04 00:35

    use jQuery. Something like:

    $(document).ready( function() {
        $("input[type='text'], textarea").attr('spellcheck',false);
    });
    

    This should search for all textbox's and teatarea's on the page and add the attribute spellcheck="false" to them.

提交回复
热议问题