Web Analytics Made Easy -
StatCounter $(document).ready(function() or $(function() - CodingForum


No announcement yet.

$(document).ready(function() or $(function()

  • Filter
  • Time
  • Show
Clear All
new posts

  • $(document).ready(function() or $(function()

    Hello all. I have fairly simple questions regarding modifying this script: http://papermashup.com/create-a-dynamic-form-preview/ to dynamically show different parts of a form on another part of the page. I am looking to use it on most parts of my form and would like a little clarification.

    First is the use of $(document).ready(function() or $(function(). It works using either, my question is which is preferred? As I understand it using $(document).ready(function() starts the DOM immediately on page load and is useful if you need something right away. I am also using this script: http://www.dynamicdrive.com/dynamici...formwizard.htm for the form. Since the preview script is being used with the form to wizard, I don't really need it until the rest of the form loads.

    Another question would be, is there a cleaner way to go about using the preview script on say 10 different form inputs independently? For example in a single function rather than 10 different function/updates?

    I have an example of what I am trying here: http://jsfiddle.net/anhyG/1/

    Thank you in advance for any help!