Phillip Senn
Phillip Senn

Reputation: 47645

How to program for matching

Is there a jQuery plugin for dragging answers from one area to another, and thereby making a "matching" quiz have a fun factor > 0?

Example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#inventor {
    float:left;
    width:25%;
    border: 1px solid #0000FF;
}
#invention {
    float:left;
    border: 1px solid #00FF00;
    margin-left:10px;
}
</style>
</head>

<body>
<div id="inventor">
<ol>
<li>Alexander Graham Bell</li>
<li>Thomas Edison</li>
<li>Nicholas Tesla</li>
</ol>
</div>
<div id="invention">
<form>
    <ul>
    <li><input name="answer1" />Tesla coil</li>
    <li><input name="answer2" />Telephone</li>
    <li><input name="answer3" />Phonograph</li>
    </ul>
</form>
</div>
</body>
</html>

Upvotes: 1

Views: 532

Answers (1)

Nick Craver
Nick Craver

Reputation: 630607

You can use the jQuery UI Draggable plugin and Droppable plugin for this.

Here's a quick example to get you going using your markup, you can adjust whatever behavior to the way you want the quiz fun to be :)

Upvotes: 3

Related Questions