title: Run function if checkbox checked and value in input over 1000
body: <p>Right now, I'm trying to make a script for the gambling website <code>csgopolygon.com</code> and want to add the feature that doesn't allow you make bets over 1000 credits. I want it to set back the value in the <code>betAmount</code> input to 1000 if the checkbox which enables <code>AntiGreed</code> is checked and the user wrote a number over 1000 in the input with the id <code>betAmount</code>. This is what I got so far:</p>
  
  <pre><code>$("#betAmount").keydown(function () {
  if($('#antigreedcheck').is(':checked')){
      if(parseInt($("#betAmount").val()) &gt; 1000) {
          $("#betAmount").val('1000');
      }
  }
  });
  
  $("body").append('&lt;div class="modal fade" id="settingsscript"&gt;'+
              '  &lt;div class="modal-dialog"&gt;'+
              '   &lt;div class="modal-content"&gt;'+
              '           &lt;div class="modal-header"&gt;'+
              '           &lt;button type="button" class="close" data-dismiss="modal"&gt;X&lt;/button&gt;'+
              '           &lt;h4 class="modal-title"&gt;&lt;b&gt;&lt;center&gt;&lt;a href="http://bytec0.de"&gt;bytec0de&amp;#039;s&lt;/a&gt; csgopolygon script&lt;/center&gt;&lt;/b&gt;&lt;/h4&gt;'+
              '           &lt;h5 class="modal-title"&gt;&lt;center&gt;Win monies easily!&lt;/center&gt;&lt;/h5&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;'+
              '           &lt;center&gt;&lt;input type="checkbox" id="antigreedcheck"&gt;&lt;/input&gt;'+
              '           &lt;label for="antigreedcheck"&gt;AntiGreed&lt;/label&gt;&lt;br&gt;&lt;/center&gt;'+
              '           &lt;center&gt;&lt;button type="button" class="btn btn-danger" data-dismiss="modal"&gt;Close&lt;/button&gt;&lt;/center&gt;'+
              '        &lt;/div&gt;'+
              '   &lt;/div&gt;'+
              '  &lt;/div&gt;'+
              '&lt;/div&gt;');
  
  $("div .input-btn").append('&lt;div id="setcolor2"&gt;&lt;/div&gt;&lt;br&gt;&lt;b&gt;&lt;a href="#" style="font-size: 2em;" data-toggle="modal" data-target="#settingsscript"&gt; Settings&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;');
  </code></pre>
  
  <p>This code doesn't seem to work, because every time I tick the checkbox and type in more than 1000 in the betAmount input, it doesn't do anything.</p>