Javascript textarea不';无法正确渲染

Javascript textarea不';无法正确渲染,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我试着为textarea元素做一个文本计数器 起初它按我希望的那样工作 我可以删除和添加字符,效果很好 错误是当我选择所有文本并全部删除时,不知何故,textarea渲染时没有边框 我浏览了javascript,发现当我删除所有内容时,它会触发一段代码来设置计数器 counter_elem.children('.text-count').text(count); 然后textarea将无法正确呈现,但如果我注释掉这段代码,它呈现为ok 样式计算表格铬: -webkit-appeara

我试着为textarea元素做一个文本计数器

起初它按我希望的那样工作

我可以删除和添加字符,效果很好

错误是当我选择所有文本并全部删除时,不知何故,textarea渲染时没有边框

我浏览了javascript,发现当我删除所有内容时,它会触发一段代码来设置计数器

counter_elem.children('.text-count').text(count); 
然后textarea将无法正确呈现,但如果我注释掉这段代码,它呈现为ok

样式计算表格铬:

-webkit-appearance: none;
-webkit-font-smoothing: antialiased;
-webkit-rtl-ordering: logical;
-webkit-user-select: text;
background-color: rgb(255, 255, 255);
border-bottom-color: rgb(221, 221, 221);
border-bottom-style: solid;
border-bottom-width: 1px;
border-image-outset: 0px;
border-image-repeat: stretch;
border-image-slice: 100%;
border-image-source: none;
border-image-width: 1;
border-left-color: rgb(221, 221, 221);
border-left-style: solid;
border-left-width: 1px;
border-right-color: rgb(221, 221, 221);
border-right-style: solid;
border-right-width: 1px;
border-top-color: rgb(221, 221, 221);
border-top-style: solid;
border-top-width: 1px;
box-sizing: border-box;
color: rgb(0, 0, 0);
cursor: auto;
display: block;
flex-direction: column;
float: left;
font-family: 'Lantinghei SC', 'Hiragino Sans GB', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans GB', 华文细黑, STHeiti, 微软雅黑, 'Microsoft YaHei', SimHei, sans-serif;
font-size: 14px;
font-stretch: normal;
font-style: normal;
font-variant: normal;
font-weight: normal;
height: 100px;
letter-spacing: normal;
line-height: 24px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
outline-color: rgb(86, 90, 92);
outline-offset: 0px;
outline-style: none;
outline-width: 0px;
overflow-x: auto;
overflow-y: auto;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
padding-top: 20px;
resize: none;
text-align: start;
text-indent: 0px;
text-rendering: auto;
text-shadow: none;
text-transform: none;
transition-delay: 0s;
transition-duration: 0.2s;
transition-property: border-color;
transition-timing-function: ease;
white-space: pre-wrap;
width: 800px;
word-spacing: 0px;
word-wrap: break-word;
writing-mode: lr-tb;
-webkit-writing-mode: horizontal-tb;

我不知道为什么,但它解决了问题

这是一段代码:

<textarea class="textarea-control work-content" placeholder="录入一条日常工作内容" id="id_work_content_1"></textarea>

这是错误代码:

<textarea class="textarea-control left work-content" placeholder="录入一条日常工作内容" id="id_work_content_1"></textarea>


唯一不同的是左侧,它使textarea向左浮动。所以在这种情况下,如果它没有向左浮动,它就可以正常工作。因此,有些东西与浮动不兼容

请创建一个jsfiddle,尝试共享所有相关代码/演示,以更好地帮助您