Home > front end >  CSS: Text area is not draggable
CSS: Text area is not draggable

Time:12-21

text area is not draggable when enter less words or no words

text area is draggable only when enter words exceeds visible text area

css: textarea {overflow: auto;}

It's not working when I add

resize: both;

or with !important

Does anyone know how to fix this?

CodePudding user response:

just do this in html without css and it will work <textarea type = "text" draggable = "true" cols = "40" rows = "5">

CodePudding user response:

 <style>
        .textarea{
            resize: none;
        }
</style>
<textarea id="textarea" rows="10" cols="50" oninput="change()">Write something here</textarea>
<script>
    function change() {
        const dom = document.querySelector('#textarea');
        if (dom.value.length > 40) {
           dom.classList.remove('textarea')
        }else{
            dom.classList.add('textarea')
        }
    }
</script>
  • Related