I'm learning javascript and my project requires me to build a webpage that has two dice images, an input box, and a button. After an input is given the button can be pushed and the javascript will tell you how many rolls it took to get that value and the dice images will display that value. My trouble is that I can't get the dice to display the total and I'm not getting the correct number of rolls. It always says that it took 1 roll.

```js
//define a Dice object, properties and methods
var Dice = {
    sides: 6,

    rollDie: function(diceElement) {
        var rolledValue = Math.floor(Math.random() * this.sides) + 1;
        var diceImage = this.getURL(rolledValue);
        diceElement.attr("src", diceImage);
    },

    rollDice: function() {
       var diceTotal = 0;
       diceTotal += this.rollDie($('#dice1'));
       diceTotal += this.rollDie($('#dice2'));
       return diceTotal;
    },

    rollDoubles: function(n) {
       var die1 = 0;
       var die2 = 0;
       var numRolls = 0;
        do {
            die1 = this.rollDie($('#dice1'));
            die2 = this.rollDie($('#dice2'));
            numRolls++;
        } while(!(die1 == die2 && die1 == n));
        return numRolls;
    },

    URL_prefix: "http://dave-reed.com/book3e/Images/",

    getURL: function(n) {
        //return the URL for an n-dot die
        return this.URL_prefix + "die" + n + ".gif";
    }
};

//top-level function
function roll_number(n) {
  var die1 = Math.floor(Math.random() * Dice.sides) + 1;
  var die2 = Math.floor(Math.random() * Dice.sides) + 1;
  var dicetotal = die1 + die2;
  var numRolls = 0;
    //roll two dice until you hit n
  do {
      die1 = Dice.rollDie($('#dice1'));
      die2 = Dice.rollDie($('#dice2'));
      numRolls++;
  } while(dicetotal == n);  
  return numRolls;
    //return the number of rolls
}

function getRoll () {
  var number = parseFloat($("#num").val());
  var numRolls = roll_number(number);
  $("#time").text( "You rolled " + number + " in " + 
    numRolls + " rolls");
}

$(document).ready(function(){
  $("#R").on("click", getRoll);
  //$("#roll").on("click", Dice.getURL);
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!Doctype html>
<html>

<head>
    <title>Dice-namic</title>
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="Dice-namic.js"></script>
</head>

<body>
    <h2>Roll Number</h2>
    <img id="dice1" src="http://www.dave-reed.com/book3e/Images/die1.gif">
    <img id="dice2" src="http://www.dave-reed.com/book3e/Images/die1.gif">
    <p>Enter target number:</p>
    <input type="text" id="num">
    <br>
    <br>
    <button id="R">Roll 'em!</button>
    <br>
    <br>
    <div id="time">Test</div>
</body>

</html>
```