使用向上和向下箭头搜索控件 [英] search control with Up and down arrow
本文介绍了使用向上和向下箭头搜索控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
创建
a搜索控件的最佳方法是使用带有向上和向下箭头的文本框(输入搜索字符串)来遍历树的上下节点。当按下''输入时''在搜索框中输入字符串后,它应该在节点的向下搜索。
我现在面临的一个问题是,当我按下输入时,它正在提交表单。我确实尝试过event.preventdefault但它仍然没有工作。
What is the best way to create
a search control which has a textbox(to enter search string) with Up and down arrow to traverse up and down node of trees.Also when pressing ''enter'' after giving string in search box , it should search in down direction of nodes.
one issue that i am facing as of now is when i press enter it is submitting the form. I did try event.preventdefault but it is still not working.
推荐答案
即使jQuery被标记,我也没有看到你使用它。我认为使用jQuery没有问题.keypress()
:
http://api.jquery.com/keypress/ [ ^ ]。
再次,你永远不应该使用Up
和Down
键,因为它们保留用于滚动,光标模式下的光标移动等等。使用别的东西,可能是Ctrl + Up,Ctrl + Down。
-SA
Even though jQuery is tagged, I don''t see that you used it. I see no problem in using jQuery.keypress()
:
http://api.jquery.com/keypress/[^].
Again, you should never useUp
andDown
keys, as they are reserved for scrolling, cursor motion in cursor mode and more. Use something else, maybe Ctrl+Up, Ctrl+Down.
—SA
这篇关于使用向上和向下箭头搜索控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文