Skip to content
Browse files

Correctly clear comment box example texts on submit.

  • Loading branch information...
1 parent 86e5f6f commit 017b0c563bf355837b791c681d12a8d67bcf2b81 @FooBarWidget FooBarWidget committed
Showing with 9 additions and 4 deletions.
  1. +9 −4 app/views/api/base.js.erb
View
13 app/views/api/base.js.erb
@@ -38,10 +38,15 @@ if (!Juvia) {
$('input[name=author_email]', addCommentForm).example('Your email (optional)',
{ className: 'juvia-example-text' });
- // Must be bound after setting input examples because we
- // want jquery.example to clear example texts before we
- // query those fields' values.
- addCommentForm.submit(self.submitComment);
+ /* Our submit handler is called before jquery.example has cleared the
+ * example texts. We work around this by calling our actual
+ * submit handler a short while later.
+ */
+ addCommentForm.bind('submit', function(event) {
+ setTimeout(function() {
+ self.submitComment(event);
+ }, 1);
+ });
$('.juvia-help', this).bind('click', function() {
var $this = $(this);

0 comments on commit 017b0c5

Please sign in to comment.
Something went wrong with that request. Please try again.