Working with drag and drop

Another HTML construct that is hard to work with is a page that allows you to drag and drop elements. For this example, we will create a simple HTML page that uses jQuery to allow us to drag some elements around the screen. We are also going to add an element that will destroy any of the draggable elements that we drop onto it so that these draggable elements can be removed from the page. Let's start off with the basic HTML:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset=utf-8> 
    <title>Drag and drop</title> 
    <style type="text/css">${TBC}</style> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery    /2.1.3/jquery.min.js"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui /1.11.3/jquery-ui.min.js"></script> ...

Get Mastering Selenium WebDriver 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.