TTT
TTT

Reputation: 1

CSS: Text area is not draggable

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?

Upvotes: 0

Views: 638

Answers (2)

Jlassi Mohamed Yacine
Jlassi Mohamed Yacine

Reputation: 11

Just do this in HTML without CSS, and it will work -

<textarea type = "text" draggable = "true" cols = "40" rows = "5"></textarea>

Upvotes: 1

vueAng
vueAng

Reputation: 453

 <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>

Upvotes: 0

Related Questions