如何在文本框上使用JQuery的拖放? [英] How can I use JQuery's Drag and Drop on a TextBox?

查看:77
本文介绍了如何在文本框上使用JQuery的拖放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery并想移动一个文本框,就像在使用draggable函数将其拖动时一样,也将其设置为droppable()以便在其上放置一些属性.我无法使文本框不可拖放吗?仅当我用Div包围文本框时才有可能.为什么会这样呢?用文本框实现上述两个功能的正确方法是什么?

I am using JQuery and want to move a textbox.As in drag it using the draggable function and also make it droppable() so as to drop few properties onto it. I am not able to make the textbox draggable neither droppable ? It only becomes possible when I surround the textbox with a Div. Why is it so? What is the correct way of implementing both the above functions with textbox?

推荐答案

默认情况下,输入元素是可拖动的注释,因为它不知道您是要拖动文本框还是将焦点放在文本框上.

Input elements are note draggable by default, because it will not know if you want to drag the textbox or just put the focus on it.

这是输入元素的默认取消选项,但您可以覆盖它

It is the default cancel option for input elements, but you can override it

$("#yourTextBox").draggable({ cancel: null }); 

这篇关于如何在文本框上使用JQuery的拖放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆