I have the following jQuery functions:
1) Gives shape
$(".content").delegate('.entryButton','click', function() { var form = $(this).closest("form"); var id = form.attr('id'); var text = form.find("textarea").val(); Sijax.request('add_entry', [id, text]);
2) Enlarge the form and show the enter button
$("textarea").focus(function() { $(this).css('height', '80px'); var button = $(this).parent().next().children(); button.css('visibility', 'visible'); button.css('height', '20px') });
3) Reduces the size of the text field and hides the button
$("textarea").blur(function() { $(this).css('height', '30px'); var button = $(this).parent().next().children(); button.css('height', '0px') });
This happens when I try to record:
- Click in the field (focus event), the field becomes larger and shows the enter button
- Enter text
- Press the enter button for the first time: Now the blur event fires, which makes the field smaller, but the click event does not fire
- If I click the button again, the form will submit
I think this means that the blur and click event interfere with each other?
You can find the script problems here . . When you press a button with a focused field, it blurs the field, but does not. Enter it. When you press the blurred button, the recording is sent.
Any ideas?
Thanks in advance!
jquery
arnoutaertgeerts
source share