I have an input element inside a draggable div. My code should do the following things:
- When I drag my input element, entire draggable div should be dragged. (Accomplished)
- When I click on the input element, I should be able to edit the text. (Could not accomplish)
So, could some one tell me how to click and edit the text of an input element which is draggable as well?
Here is my complete code:
<!DOCTYPE html>
<html>
<head>
<title>Draggable and Clickable Input</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.js"></script>
<style>
.draggable{height:500px;width:500px;background:blue;}
</style>
</head>
<body>
<div class="draggable" >
<input type="text" value="drag me!"/>
</div>
<script>
$('.draggable').draggable({
cancel: ''
});
</script>
</body>
</html>