Thanks. I've been looking for an example of this for a long time.
On Jul 22, 2:33 pm, Michael Lawson <mjlaw...@us.ibm.com> wrote: > No, i was thinking something like this > > <script language="javascript" type="text/javascript"> > function getDirectorIds() { > var result = ""; > $(".chkDirector:checked").each(function() { > result = result + $(this).val() + ","; > }); > // place the selected id_individual values in the label > control lblCheckedDirectors2 > document.getElementById('lblCheckedDirs').value = > result; > } > > // this gets all of the director id_individual values > $(document).ready(function() { > getDirectoryIds(); > }); > </script> > > Typically, you use $(document).ready(function(){...}); to run a function > after the document is finished loading, when its ready. Not to actually > define the function :) > > cheers > > Michael Lawson > Development Lead, Global Solutions, ibm.com > Phone: 1-276-206-8393 > E-mail: mjlaw...@us.ibm.com > > 'Whether one believes in a religion or not, > and whether one believes in rebirth or not, > there isn't anyone who doesn't appreciate kindness and compassion..' > > From: "evanbu...@gmail.com" <evanbu...@gmail.com> > > > To: "jQuery (English)" <jquery-en@googlegroups.com> > > > Date: 07/22/2009 02:18 PM > > > Subject: [jQuery] Re: Calling other functions inside a function > > > Is this the right way to do it ? > > <script language="javascript" type="text/javascript"> > // this gets all of the director id_individual values > $(document).ready(function() { > function getDirectorIds() { > var result = ""; > $(".chkDirector:checked").each(function() { > result = result + $(this).val() + ","; > }); > // place the selected id_individual values in the label > control lblCheckedDirectors2 > document.getElementById('lblCheckedDirs').value = > result; > } > }); > </script> > > On Jul 22, 11:34 am, Michael Lawson <mjlaw...@us.ibm.com> wrote: > > > > > > > Maybe you should pull the definition of the function out of the document > > ready definition? > > > cheers > > > Michael Lawson > > Development Lead, Global Solutions, ibm.com > > Phone: 1-276-206-8393 > > E-mail: mjlaw...@us.ibm.com > > > 'Whether one believes in a religion or not, > > and whether one believes in rebirth or not, > > there isn't anyone who doesn't appreciate kindness and compassion..' > > > From: "evanbu...@gmail.com" <evanbu...@gmail.com> > > > To: "jQuery (English)" <jquery-en@googlegroups.com> > > > Date: 07/22/2009 11:21 AM > > > Subject: [jQuery] Re: Calling other functions inside a function > > > Thank you. The Firebug suggestion was helpful. The error message is > > saying that getDirectorIds() is not defined. > > > <script type="text/javascript"> > > // make sure at least one checkbox is checked > > function validateSubmit() { > > if( $("input:checkbox:checked").length == 0 ) { > > alert( "Please select at least one section for your PDF profile" ); > > return false; > > } else { > > createCharts(); > > > // error occurs here > > getDirectorIDs(); > > return true; > > } > > } > > </script> > > > This is the getDirectorIDs() function: > > > <script language="javascript" type="text/javascript"> > > // this gets all of the director id_individual values > > $(document).ready(function getDirectorIDs() { > > var result = ""; > > $(".chkDirector:checked").each(function() { > > result = result + $(this).val() + ","; > > }); > > // place the selected id_individual values in the label control > > lblCheckedDirectors2 > > document.getElementById('lblCheckedDirs').value = result; > > > alert("cool"); > > }); > > </script> > > > On Jul 21, 7:28 pm, "Michael Geary" <m...@mg.to> wrote: > > > > The reason this would happen is that you have a fatal error somewhere > > inside > > > your createCharts() function. When this error occurs, it stops all > > > JavaScript execution for the current event. > > > > Do you have any debugging tools such as Firebug? If not, install > Firebug > > and > > > try again. Open the Firebug panel and make sure it's enabled for your > > site, > > > then reload the page and do whatever you need to do to trigger the > error. > > > > It's very likely that Firebug will give you an error message showing > > exactly > > > what the problem is. > > > > If the problem isn't clear from that message (or if you don't get one), > > try > > > sprinkling the code inside createCharts() with console.log() calls: > > > > function createCharts() { > > > console.log(1); > > > // some of your code here > > > console.log(2); > > > // some more of your code here > > > console.log(3); > > > // and some more of your code here > > > console.log(4); > > > } > > > > By watching the Firebug console, you will then be able to see which of > > your > > > console.log() calls were actually executed. > > > > -Mike > > > > > From: evanbu...@gmail.com > > > > > This is probably more of a basic javascript question than a > > > > specific jquery function. I have this jQuery function named > > > > validateSubmit() which calls two other regular javascript > > > > functions. When using IE, both createCharts() and > > > > getDirectorIDs get called but when using FireFox, only > > > > createCharts() gets called and never makes it to > > > > getDirectorIDs() and I'm not sure why this occurs. Thanks > > > > > <script type="text/javascript"> > > > > // make sure at least one checkbox is checked function > > > > validateSubmit() { > > > > if( $("input:checkbox:checked").length == 0 ) { > > > > alert( "Please select at least one section for your > > > > PDF profile" ); > > > > return false; > > > > } else { > > > > createCharts(); > > > > > getDirectorIDs(); > > > > return true; > > > > } > > > > } > > > > </script>- Hide quoted text - > > > > - Show quoted text - > > > graycol.gif > > < 1KViewDownload > > > ecblank.gif > > < 1KViewDownload- Hide quoted text - > > > - Show quoted text - > > > > graycol.gif > < 1KViewDownload > > ecblank.gif > < 1KViewDownload- Hide quoted text - > > - Show quoted text -