javascript - JQuery effect working in firefox; not chrome / ie -
This problem makes me wonder because it does not even work in Chrome chrome !!
Anyway, I have 3 selection boxes, A, B, C. On page loads, B and C are hidden (this is okay in all browsers). Currently, I have an event handler attached to specific values in box A, so if a value is clicked, then B. indicates that there is population along with the results for C. The only thing for C: If a value is clicked in B, then C will show itself.
However, this "show" effect is only in Firefox - Chrome and IE are confusing.
Any suggestions? Hint? Here are some code:
$ (document) .ready (function () {$ ("# B"). Hide (); $ ("# c"). Hide (); $ ('Choose #A option'). Each (function () {$ (this). Click (function () {$ .getJSON (luggage, callback (data));});});}); Function callback (data) {// alert ("hi"); // It is not working for Chrome / IE! Therefore, callback is not called $ ("#b"). Show (); // It is not working for Chrome / IE! }; Edit: Turns it, 'Select #A option' - 'Option' tag was buggy after "making changes" to my handler, I debug and debug it. It was capable until I removed the option tag - everything seems to work now. Thanks, Micheal
The real problem is in the following line: / P>
// ... $ .getJSON (luggage, callback); // ...
You are not passing the callback function, you are actually executing the function and passing undefined
because it returns anything does not do.
You should reference only the function:
// ... $ .getJSON (luggage, callback); // ...
Or use an anonymous function in place:
// ... $ .getJSON (luggage, work (data ) {$ ("#b"). Show ();}); // ...
Edit: I have not seen about the click handler which you are trying to assign, I recommend using an option to ensure that an option is chosen:
$ (document) .ready (function () {$ ("# B, # C") Change (function () {$ .getJSON (Accessories, Functions (Data) {$ ("#b"). Show ();});});} );
Comments
Post a Comment