简体   繁体   English

文本区域和下拉列表集体管理

[英]Textarea and dropdown collective management

Hy!

Here's a Plunker DEMO: http://plnkr.co/edit/gBFRpL1zOfMtKcQBA0j1?p=preview 这是一个简单的演示: http ://plnkr.co/edit/gBFRpL1zOfMtKcQBA0j1?p=preview

I want the dropdown to show if textarea has the focus. 我希望dropdown显示textarea是否具有焦点。 If it's blurred, the dropdown should hide. 如果模糊,则下拉菜单应隐藏。

But if I click on the dropdown, the textarea loses focus. 但是,如果我单击下拉列表,则文本区域将失去焦点。 The textarea should not lose focus, when the dropdown is clicked. 单击下拉列表时,textarea不应失去焦点。

Any ideas? 有任何想法吗?

Thanks for answers! 感谢您的回答!

Your problem here is, that of course if you click on the dropdown, the dropdown has the focus! 这里的问题是,如果您单击下拉列表,那么该下拉列表将成为焦点! And if the dropdown has the focus, the textarea loses its focus. 如果下拉列表具有焦点,则文本区域将失去焦点。 Do you understand the problem? 你明白这个问题吗?

Try to change your logic. 尝试改变您的逻辑。

  • textarea: focus , dropdown: blur, dropdown: show textarea: 焦点 ,下拉列表:模糊,下拉列表: 显示
  • textarea: blur, dropdown: focus , dropdown: show textarea:模糊,下拉菜单: focus ,下拉菜单: show
  • textarea: blur, dropdown: blur, dropdown: hide textarea:模糊,下拉菜单:模糊,下拉菜单:隐藏

only one element can have the focus! 只有一个元素可以具有焦点!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM