Javascript specific to Chrome - javascript

I have lots of rails and javascript code in one project. So far it works fine, but on one particular place Javascript is not working in Chrome, works in other browsers.
The form itself has a checkbox. Once it is selected it will enable textboxes on the form. On initial load, it is not enabling the fields. But as soon as I select "inspect elements" in Chrome, and close inspect elements window it starts working, javascript kicks in and works as it should.
There is so much code behind, that it would be really difficult to post it here. I am hoping there is some "magic" only specific to Chrome.
Did anyone ever had this kind of problem before?

Related

My javaScript code is causing IE to time out but works on Chrome and Firefox

I have some code that detects when a radio button is clicked in a form and then clicks a "Next" button. The form is multi-page wizard style.
It works fine in Chrome and Firefox but it causes IE to time out with a Not Responding error when I click the radio button there.
Here's the code:
jQuery(function($) {
$('#UL_24').on('click', function() {
var $form = $(this).closest('form');
$form.find('.gform_next_button').click();
});
});
Here's a JSFiddle of the HTML and JS together: http://jsfiddle.net/zpjyndd6/1/
Note that the redirect upon click works in this JSFiddle. It just goes to a page not found because I'm using a relative URL within the form action.
I just tested this JSFiddle in IE and the redirect actually works in this. So I'm guessing there is something outside of this code that is blocking it within IE. Not sure why it still works in Chrome and Firefox though.
Any ideas would be much appreciated.
The code in the JSFiddle might look a little off because I used a Chrome Extension to grab the block of HTML and related CSS from within a larger page. It changed the names of some of the IDs automatically and did some other strange things. It shouldn't impact this question though.
The way I read your code, looks like you have messed up little with HTML. Anyway that is a different problem.
Try using .trigger('click') instead of .click().

Accordion getting sporadically hidden in IE 7-8

I am using jQuery accordion on a web page. In IE 8, it gets hidden sporadically sometimes when user clicks on some other window. I am not able to get why is it behaving like this. When I inspect element in HTML developer tool I could see accordion and if I change some value in that, accordion gets visible again. Can somebody please help me to identify what is the problem? If I use debugger mode everything works correctly.
I looked at code carefully and observed that accordion code was added in one extra tag but strange that only IE was not able to run it properly. So I removed that extra wrapper and its running properly now.

jqueryui button not displaying

I just created a theme using the jquery ui theme roller. I just downloaded it then opened up the index.html that it comes with to display all the content. Everything displays except for the buttons and radio buttons. This is the only part I really care about. Which is kind of funny that this is the only part that doesn't work. I tested it in IE, Chrome, and Firefox and none of them display the buttons. Am I missing something?
Nevermind. They do not actually include the code for the button but for everything else.

Using a decoy breaks my upload on IE. Why?

I'm using Valums AJAX Uploader and it works just fine, even in IE.
The problem appears when i try to use a decoy to hide Valums markup.
$('.control.addphoto:not(.controlactive)').live('click', function(){
$('#upload input[type=file]').click();
});
so, the real input is hidden but clicking my control activates it. The "choosing file" dialog gets displayed just fine in IE but once i click OK the file upload fails (it doesn't even get to the server). When I doesn't use the decoy (i.e. when i click in the input directly) it works just fine.
Everything works fine in Chrome and Firefox.
Why is this happening? I couldn't understand since it's just a decoy and it's calling the actual input. Any clue? Any way to make the decoy more "transparent"?
obs: just found out that the decoy isn't working on Opera (doesn't opens the dialog). Again, clicking directly on the input works fine. Shouldn't this be working since i'm using jquery (wich is suposed to be crossbrowser)?
EDIT
Opera actually doesn't allow triggering the input behavior through a decoy by nature.
Using Kevin B's alternative i've been able to solve my problem. On the other hand i still don't know why that happened with IE and will keep this question opened for the sake of knowledge.
One solution to this is to make the trigger element invisible, but not hidden, such as giving it the same background color as the element behind it. You can then place it on top of the "decoy" so that it will look like you are clicking on the decoy, while you are actually clicking on the file input.

chrome safari javascript jquery back

Is there anything particular to chrome or safari that would make a javascript/jquery script work on the first page load, but then when the user hits the back button after navigating the site, it causes select boxes to be selected?
Here is the code. Apologizes before hand for the lack of conventions. I had to get this up quick:
http://www.mailcanarias.com/index.php
I believe that's because (at least Safari) auto-refills forms when you go back

Categories