Skip to content Skip to sidebar Skip to footer

Form Event Incompatibilities Between Browsers, How To Address?

I have a textarea on a html page, on google chrome, well I don't know what version because the user interface is deviously hidden, but on chrome the onChange='code' event isn't fir

Solution 1:

Here's the thing about why jQuery is so amazing. It understands the need to gracefully degrade the code between browsers that don't support newer functionality. JavaScript in and of itself does not offer this support stand alone. By enhancing JavaScript's core capabilities in using jQuery, you are generally going to be more successful with cross browser support.

That being said...

There are still plenty of scenarios where you need to identify what device/browser you're working with so that you can perform the expected operations.

The most important thing to remember is that there is no 100% cross-support library in existence.

Solution 2:

you can do this. just make sure you give the textarea an id tag

$(document).ready(function(){
        $('.addtitle').keyup(function(event) {
            if(event.keyCode==13) { 

}
});
});

in my case here, im firing the function on the enter key (like facebooks functions).

EDIT: also if you have more then one textarea on a page, you should do this:

$(document).ready(function(){
        $('textarea[name=mynamevalue]').keyup(function(event) {
            if(event.keyCode==13) { 

}
});
});

Post a Comment for "Form Event Incompatibilities Between Browsers, How To Address?"