EDIT:**I already have the divs cloned. All i need is a selector that will select both the form field and the container that are already cloned and have the same class. So there are sets of Divs and Form fields with classes like Question1, Question3, Question7 etc. I need the Value of Form Question1 in #div to be the .html() of the div question1 inside #another div. Need a function that can do this for Question1, Question3, Question4, and all other Question# classes that exist . **END EDIT
I have a set up where, clicking on a button called Add Questions clones a set of form fields, but also a set of (hidden) empty container like <h2></h2> the form field and its corresponding container have the same class but are in different divs (the divs have different ids), and they are the only fields with that class on the page. What I need to do is something like this. After generation, the user fills in the form. This data needs to be filled into the corresponding container (the one with the same class) using .html().
Like this but it needs to do this for all the fields with classes similar to question#:
var form = $("#divcontainer .sameclass[#]").val();
$('#anotherdiv .sameclass[#]').html(form);
The dynamically generated forms and the container have classes like "question1, question2" etc but they may not be in the right order and may skip numbers. so it may be "question1 for the first form and container and question7 for next form field and container“
Is there some wildcard or something I could use for this?
try this..how bout this..dont get exactly the code get what i mean