jquery - Adding classes to appended content -


Hey all, I'm going to jump right in and describe the problem. JS Fendills are made available to help you understand. Any help is greatly appreciated. Thanks!

Function 2: Define the type of program

The user can add additional registration form, then

Function 2: Define the type of program

Users can choose from a variety of types of program registration available, when selecting a program, it is suitable for external files Appropriate receives form.

2 problem

When the program type is assigned to the registration form, then it returns data in a single device with a specific class. This is obviously a problem because it will return that data to all the devices along with that data. If you add more than one registration then there will be many divs with this class.

This device is caught in the first function when the registration form is added initially.

3 need for solution

I need to dynamically add numbers to this div's class, every time a new program is added. This will make each div unique and will end the problem.

  & lt; Div class = "reg" & gt; & Lt; / Div & gt; & Lt; Div class = "reg" & gt; & Lt; / Div & gt; & Lt; Div class = "reg" & gt; & Lt; / Div & gt; & Lt; Div class = "reg" & gt; & Lt; / Div & gt;   

Ideally this should be something like this:

  & lt; Div class = "reg1" & gt; & Lt; / Div & gt; & Lt; Div class = "reg2" & gt; & Lt; / Div & gt; & Lt; Div class = "reg3" & gt; & Lt; / Div & gt; & Lt; Div class = "reg4" & gt; & Lt; / Div & gt;   

I do not have a clue how to get started with this, but it must be a part of the original function.

If the problem is that clicking on a registration checkbox changes all registrations, then you Your selectors will have to make better scope. For example, think each registration appears something like this:

  & lt; Div class = 'registration' & gt; ... a bunch of stuff & lt; Input type = 'checkbox' class = 'blah' / & gt; & Lt; / Div & gt;   

You now have a handler to click on such checkboxes:

  $ ('.registry input [type = checkbox]'). Live ('change', function () {// data which checkbox was checked and whatever, // affects checkboxed registration only: var affects: registration = $ (this) .clostest ('. '); // do some smart with impressive registration ...});   

Note: If you post your actual code here, you can get more help, but I think it will let you go.

Comments