I am trying to make a basic randomizer that can match things. Sort of like a date(Romance) picker, but different situation.
I want the product to look like this:
(User Input A1)
(User Input A2)
(User Input A3)
(User Input B1)
(User Input B2)
(User Input B3)
Where an A input randomly matches a B input, but A never matches an A, and A doesn't randomize.
So it looks like this:
A1 - (B#)
A2 - (B#)
A3 - (B#)
Problem is, I suck at JS. I take some classes on Codecademy, being HTML / CSS / jQuery. I keep trying different things, but they keep failing. Can someone help me?
HTML:
<!DOCTYPE html>
<html>
<head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<meta charset=utf-8 />
</head>
<body>
<ul> People
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
</ul>
<hr />
<ul> Jobs
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
<li><input></input></li>
</ul>
</body>
</html>
JS:
$(document).ready(function () {
$('#jobs').find('li').shuffle();
var mynewlist = '';
$('#people').find('li').each(function (index) {
var jb = $('#jobs').find('li').eq(index);
mynewlist += '<li>Person:' + $(this).text() + ' Job:' + jb.text() + '</li>';
});
$(mynewlist).appendTo('#newList');
});
This is what I have.
I want the inputs to randomize, but it doesn't work.
This is my first post. Sorry if it breaks the rules or anything, but I told my boss I'd get this done 2 weeks ago.