jQuery: The Write Less, Do More JavaScript Library

Can't get FF 3 to respond to keyup()

View: New views
2 Messages — Rating Filter:   Alert me  

Can't get FF 3 to respond to keyup()

by shenry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a page that calculates some values on the fly whenever a key is
pressed (using keyup(); ). Here is the script (go easy on me, I'm a
noob):

$(document).ready(function() {
        $(document).keyup(function() {
                var ph = $("input#ph").val();
                var targetMSO2 = $("input#target-mso2").val();
                var currentFSO2 = $("input#target-fso2").val();
                var exp = ph - 1.83;
                var currentMSO2 = currentFSO2 / ( 1 + Math.pow(10, exp) );
                var reqFSO2 = targetMSO2 * ( 1 + Math.pow(10, exp) );
                if (currentMSO2 > 0) {
                        $("span#output-mso2").text(roundNumber(currentMSO2,2) + " ppm");
                } else {
                        $("span#output-mso2").text("");
                }
                if (reqFSO2 > 0 ) {
                        $("span#output-fso2").text(roundNumber(reqFSO2, 0) + " ppm");
                } else {
                        $("span#output-fso2").text("");
                }
        });
});

This works in FF3.5 (OSX), Safari, and Chrome, and _not_ in FF3 (for
PC) or IE7. You can see a working example at http://wineadds-heroku.com/so2/molecular

Any ideas? Strange that FF is misbehaving, makes me wonder if my Dell
laptop is not sending the keyboard events the way the browser expects?

Thanks for any help,

Stu

Re: Can't get FF 3 to respond to keyup()

by shenry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Answered my own question, posting here in case others have the same
issue.

Apparently the problem was with the variable name ph... must be a
namespace issue with jQuery.

Changing the variable to xph in the script made it work fine in FF3
and IE7.

Stu