Where to write a jquery script for a registration form page which created using webform module in Drupal 7? I have created a registration form page using the webform module. The registration form page contains personal info and billing info groups with fisrtname, lastname, email, age fields and a check box saying "billing info same as personal info". Where should I write a jQuery script to put all the personal info in billing info fields when the check box is checked?


I have created a js folder/check_box.js file in the bartik theme folder which i am using
then made changes in bartik.info file as scripts[]=js/check_box.js
then added drupal_add_js in template.php
cleared all caches


but still I cannot execute my script which I have written for check box or the fields.

$("#checkbox_id").change(function() {
  if(this.checked){
    alert("checked");
    });
})(jQuery); 


This is my code to check whether its working or not. Is it correct? If not please help me with the code.
First off, as rooby very accurately suggested in the comment section, you should not tamper with the Bartik theme directly. You have many possibilities on where to include a js script. You can read all of them in the relevant documentation in drupal.org.

The closest to what you describe is to subtheme Bartik and put all necessary js there, or even create a small custom module.

Apart from that, jQuery in Drupal uses the noconflict mode. Try to avoid the dollar sign but rather call jQuery. Although in your particular code should be ok as it is, there may be other instances in your script using $ that would prevent it from working. More on that here. Check your browser for js errors.

Last, there is no way for us to evaluate your jQuery code if it works properly or not as we do not have the produced HTML output nor the context of your provided js code.