View Full Version : How can we know the drag event inside the textbox using javascript?
roshanbh
May 4th 2008, 10:17 am
Well, I've a textbox in my form and I want to handle the drag event inside that textbox. If someboxy drags over that textbox I want to display the erro message. Does anyone know how to know the drag even inside the textbox ??
premium_coder
May 4th 2008, 4:50 pm
javascript has an event called onDragLeave that will do what you want
premium_coder
May 4th 2008, 4:51 pm
if you want an example just tell me or if you want i help you let me know
roshanbh
May 4th 2008, 10:51 pm
please can you write two line of code in which it just alert hi on the dragevent...
premium_coder
May 5th 2008, 12:18 pm
try this and tell me if this is what you want
<html>
<head>
<script language="JavaScript">
<!--
function function1() {
msg = 'on' + event.type + ' event fired by ' + '"' + event.srcElement.id + '"';
alert(msg+"\nPress Enter twice to close this window")
}
-->
</script>
</head>
<body bottommargin=150>
<p>Source object:
<input id="sourceObject" size=50 value="The text to Drag" ondragleave="function1()">
<br>
</p>
<p>Drop selected text into the following text field.</p>
Target object:
<input id="targetObject" size=50 value="Drag destination element">
</body>
</html>
roshanbh
May 6th 2008, 9:32 am
Thanks premium coder....thats what I wanted.........thanks a lot for this......
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.