JQuery simple hide of div not working

tonimarie 23 Dec, 2014
Having some trouble loading a simple Jquery function to hide(); a div when the form loads. (Once I'm sure this is working, I'll worry about the ACTUAL validation to show when the results field is above the mathematical threshold.)

I have tried many, many ways and even tried copy/paste of the code you posted here :
http://www.chronoengine.com/forums/posts/t97729/p337274/hide-a-container-on-load-the-form.html#p337274
with just the div ID changed.

For some reason, JQuery isn't loading and running on this form.

Challenges: the form is generated out of a very complex spreadsheet that auto-updates a results field value when any other data box is changed--it's pasted into the "code" area of the form, and not made using the designer/wizard.

note: in my source code:
<script type="text/javascript">jQuery(document).ready(function($){
});
LoadFromQueryString();GetCookies();recalc_onclick("");" onunload="SetCookies();

jQuery(document).ready(function (jQ) {
  jQ('#resultbox2').hide();
});</script>


See that the jQuery document ready tag is closed before anything in my javascript on load box loads (from the on load Javascript box in Setup). Does that cause the conflict? And if so, is it a fault of CF V5?
Max_admin 25 Dec, 2014
Hi Toni,

Please add your code inside a "Load javascript" action and it should work!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 27 Dec, 2014
Hi tonimarie,

There are some oddities in your JavaScript that may be causing the problem.

a) as Max said, load it from a Load JavaScript action - but remove the <script> and </script> tags.

b) The first jQuery(document).ready(function($){}); does nothing.

c) The line that starts LoadFromQueryString(); isn't good JavaScript - check the quotes! - and I suspect that it is calling functions from some library that isn't being loaded in this snippet.

Bob
This topic is locked and no more replies can be posted.