Skip to content

Commit

Permalink
Preventing big values from going into points input.
Browse files Browse the repository at this point in the history
  • Loading branch information
exupero committed Sep 6, 2011
1 parent 351ed5f commit 619ca56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions public/javascripts/script.js
Expand Up @@ -53,6 +53,14 @@ function registerWidgetEvents() {
socket.emit('task-not-done', text);
}
});

$('input[max="99"]').bind({
keypress: function(event) {
if (parseInt($(this).val()) > 9) {
event.preventDefault();
}
}
});
};

function registerSocketEvents() {
Expand Down
4 changes: 2 additions & 2 deletions views/index.jade
Expand Up @@ -8,7 +8,7 @@ div.scoreboard
ol.scores
for score in scores
li.score
span.points= score.score
span.points= Math.round(score.score)
span.name= score.name

div.add-task
Expand All @@ -21,7 +21,7 @@ div.add-task
textarea(name='text', placeholder='To Do')
input(name='due', placeholder='Due')
label
input(type='number', name='points', value='0')
input(type='number', name='points', value=0, max=99)
| points
div.assigned-to
input(class='assignee', placeholder='Assigned To')
Expand Down

0 comments on commit 619ca56

Please sign in to comment.