简体   繁体   English

无法单击文本框来更改其值

[英]Can't click on a text box to change its value

I've got a text box I'm working on.我有一个正在处理的文本框。 When you hover over a text div, that div hides and the input tag shows (using display: none/block).当您 hover 在文本 div 上时,该 div 隐藏并且输入标签显示(使用 display: none/block)。 The text div references the value of the input tag, and the only reason the input tag isn't standard is to make it look sleeker.文本 div 引用输入标签的值,输入标签不标准的唯一原因是让它看起来更时尚。 The interaction between the two works fine, but I can't click on the text box once it's shown.两者之间的交互效果很好,但是一旦显示文本框,我就无法单击它。 If I right click on the text box, the cursor shows up as normal, then I can left click in the text box again to get rid of the right click menu and actually type in the box, editing the text div correctly.如果我右键单击文本框,cursor 正常显示,然后我可以再次在文本框中左键单击以摆脱右键菜单并实际输入框中,正确编辑文本 div。 I can also tab between text boxes to edit (this is a recurring problem), but I still can't left click on them.我也可以在文本框之间进行标签编辑(这是一个反复出现的问题),但我仍然无法左键单击它们。 If it makes any difference, I'm working within a vis.js timeline's swimlane-row-style row header.如果有任何区别,我正在 vis.js 时间线的泳道行样式行 header 中工作。

Here's the input tag:这是输入标签:

<input style='display: none;' id='editTitle' type='text' value='Title'/>

It's being created as part of a parent row header json object in the page's javascript file.它是作为父行的一部分创建的 header json object 在页面的 ZDE9B9ED78D7E2E1DCEEFFEE78 I've tried setting position to sticky and z-index as high as (2^32)-1, as well as floating it (though not together).我尝试将 position 设置为粘性和 z-index 高达 (2^32)-1,以及浮动它(尽管不是一起)。 Nothing lets me left-click it to edit.没有什么能让我左键单击它进行编辑。 This is such a strange problem to have.这是一个奇怪的问题。 I have a feeling it has something to do with an incompatibility with vis.js, but I can't be sure.我感觉它与 vis.js 不兼容有关,但我不能确定。 No errors are thrown and in the even that the user right-clicks then left clicks, the edit works correctly.不会引发错误,即使用户右键单击然后左键单击,编辑也可以正常工作。 Any ideas are appreciated.任何想法表示赞赏。

Thanks.谢谢。

I tried my best as how I understand your question and here when you point cursor on text the input appears and when mouse leave the input disappear to我尽力理解您的问题,在这里,当您在文本上指向 cursor 时, input会出现,当鼠标离开时, input会消失

 $(document).ready(function() { $('.content').on('mouseover', function() { $('#editTitle').show(200); }); $('.content').on('mouseleave', function() { $('#editTitle').hide(200); }); });
 * { box-sizing: border-box; padding: 0; margin: 0; } body { display: flex; height: 100vh; justify-content: center; align-items: center; }.container { display: flex; background: darkcyan; justify-content: center; align-items: center; flex-direction: column; width: 500px; height: 500px; } input { width: 200px; height: 30px; border: none; outline: none; border-radius: 10px; margin: 10px auto; }.content { margin: 10px auto; text-align: center; }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="container"> <input style="display: none;" id='editTitle' type='text' value='Title' /> <div class="content"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </div>

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

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