admin管理员组文章数量:1317915
I have jQuery UI accordion with input box on header:
<h3><input type="text" /></h3>
/
As expected, Accordion catches all space and arrow keypresses, that take place within header - so it's not possible to write into input box correctly. Is there any way to get rid from this behaviour, and use space and arrows, when typing there?
I have jQuery UI accordion with input box on header:
<h3><input type="text" /></h3>
http://jsfiddle/7VN8h/
As expected, Accordion catches all space and arrow keypresses, that take place within header - so it's not possible to write into input box correctly. Is there any way to get rid from this behaviour, and use space and arrows, when typing there?
Share Improve this question asked Sep 12, 2013 at 16:22 user1702401user1702401 1,6581 gold badge16 silver badges18 bronze badges 3- I don't understand your question. I'm able to enter input into the text field fine. – j08691 Commented Sep 12, 2013 at 16:24
- Check this question and the answer stackoverflow./questions/5511785/… – Marko Commented Sep 12, 2013 at 16:24
- Yes, I'm able to enter some text into the text box, but it's not possible to enter space; and to use arrow keys to navigate within text. Arun's answer solves this problem. – user1702401 Commented Sep 12, 2013 at 16:55
3 Answers
Reset to default 6You can stop the propagation of key events from the input control
$(function () {
$("#accordion").accordion();
$("#accordion h3 input").on('keydown', function (e) {
e.stopPropagation();
})
});
Demo: Fiddle
If you're looking to be able to enter input into the text field without triggering the accordion element, add this:
$('input').click(function (e) {
e.stopPropagation();
});
jsFiddle example
The below code worked well for me:
$('#TSResultContent input[type="textbox"]').keydown(function (e) {
e.stopPropagation();
});
本文标签: javascriptInput box in jQuery UI Accordion HeaderStack Overflow
版权声明:本文标题:javascript - Input box in jQuery UI Accordion Header - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742024531a2415292.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论