text input does not appear once user appends a row

筅森魡賤 提交于 2019-12-10 18:22:10

问题


I have a fiddle here: http://jsfiddle.net/ybZvv/11/

The problem I have is that when you open the fiddle, if you click on a couple of buttons from buttons "A-H" and then click on "Add Question" button to append the buttons into a new table row, no text inputs appear underneath the table.

But within the table row if you turn on a different button, then it displays the text input for that button.

What my question is that how can I have the text inputs to appear from the turned on buttons in the top control once the user clicks on the "Add Question" button?

Below is what should happen:

  1. Right at the top control, turn on buttons A and D.
  2. Click on the "Add Question" button and this should append a row, but it should also display the text inputs for buttons "A" and "D".

回答1:


I refactored some of the code from btnclick to a new method updateAnswer which collects all the buttons that are turned on and adds an input to the answer container. The method is then called from btnclick and insertQuestion.

I updated the jsFiddle example.



来源:https://stackoverflow.com/questions/12763557/text-input-does-not-appear-once-user-appends-a-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!