在当前鼠标位置点击鼠标右键插入文本框或复选框,或拖放它 [英] Insert a textfield or checkbox on mouse click at current mouse position or drag and drop it

查看:98
本文介绍了在当前鼠标位置点击鼠标右键插入文本框或复选框,或拖放它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在鼠标点击鼠标位置时动态地插入复选框或文本框,或者更好地将文本框和复选框拖放到页面的任何位置。



的目标是将可编辑的文本框和复选框添加到像 this

如果有人可以帮我解决问题,那么

会很棒。

解决方案

code> $('body')。click(function(e){$('body')。append($('< input />').css({position:'absolute',left :e.pageX,top:e.pageY})。focus());})


i am trying to insert a checkbox or textfield dynamicly on a mouse click at the mouseposition anywhere on the page or even better a drag and drop of textfields and checkboxes to any position of the page.

goal is it to add editable textfields and checkboxes to a page like this

would be great if someone could help me with it.

解决方案

Sorry for replying late, was testing actually ;) Try SOMETHING(modify the logic according to your needs) like this:

$('body').click(function(e){ $('body').append($('<input />').css({position:'absolute',left:e.pageX,top:e.pageY}).focus());})

这篇关于在当前鼠标位置点击鼠标右键插入文本框或复选框,或拖放它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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