Mercurial > public > sg101
comparison media/js/shoutbox.js @ 27:03144b0d470d
Use jQuery $.trim() in shoutbox.js.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 21 Apr 2009 23:25:05 +0000 |
parents | f408971657b9 |
children | 3ae999b0c53b |
comparison
equal
deleted
inserted
replaced
26:db40c2754580 | 27:03144b0d470d |
---|---|
1 $(document).ready(function() { | 1 $(document).ready(function() { |
2 var submit = $('#shoutbox-submit'); | 2 var submit = $('#shoutbox-submit'); |
3 submit.click(function () { | 3 submit.click(function () { |
4 var input = $('#shoutbox-smiley-input'); | 4 var input = $('#shoutbox-smiley-input'); |
5 var msg = input.val(); | 5 var msg = $.trim(input.val()); |
6 msg = msg.replace(/^\s+/, ''); | |
7 msg = msg.replace(/\s+$/, ''); | |
8 if (msg.length == 0) { | 6 if (msg.length == 0) { |
9 return false; | 7 return false; |
10 } | 8 } |
11 submit.attr('disabled', 'disabled'); | 9 submit.attr('disabled', 'disabled'); |
12 $.post('/shout/shout/', { | 10 $.post('/shout/shout/', { |