This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
How do I match the functions from the top of my jsfidde, Options, Number of Answers and Answers with the same features for each and every table row which is added when user clicks on the "Add question" button.
Can I copy and paste the functions but match them with the right ids and class which is in the insertQuestion(form) to control each feature within the rows. If so where do I copy the functions?
Follow these steps to help use the fiddle:
Step 1: Open the fiddle and you see an options and answers section on top. Open the grid and select option 8. Buttons A to H would appear.
Step 2: Type in 2 in the Number of Answers Textbox.
Step 3: Select buttons A and D, you will find out that those buttons would turn green to show they are selected. Now as you entered in 2 in the Number of answers textbox (step 2), it won't let you select more than 2 buttons, if you do an alert would apear stating you are beyond limit please deselect a button to choose another button.
Step 4. Click "Add Question", a new row is added in the table.
Step 5: In the new row you just created, lets say that oh no I made a mistake, there should be 4 answers not 2 answers and within the table row you just added you changed the number of answers textbox from 2 to 4. Select you buttons, hek select 5,6,7 buttons nothing is stopping you. This is the problem. You try and do that on the options and answers feature on top of the fiddle it does not let you do that but it lets you do it in the table row. This is the problem.
Whole code is in jsfiddle, click [here] Please test your answers in the fiddle if you wish before posting your answer. More chances of getting the correct answer