'Layout mess-up when JavaScript "keyup" run in Google Chrome
I create simple function when keyup using JavaScript like so :
<script>
//when press enter, submit this form, when press shift and enter create new line
$("#text_reply1778").keyup(function(e) {
var textVal = $(this).val();
if(e.which == 13 && e.shiftKey) {
//here create new line
}
else if (e.which == 13) {
e.preventDefault();
var text_input = $("#text_reply1778").val();
if(text_input != '') { //dont submit if value is empty
$('#reply1778').ajaxSubmit( {
target: '#reply_output1778',
success: function() {
//do somthing here
}
});
}
}
});
</script>
When I run this using browser Google Chrome Version 26.0.1410.43 my layout will mess-up but this not happen when I'm using Firefox.
You can try from here (full code) chat1.html , then type any message inside textarea(chat box) then you will see layout will mess-up.
So how to avoid this? Any method that I can use? I tried to replace keyup with keypress but the result was still the same.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
