用户追加行后,不会显示文本输入 [英] text input does not appear once user appends a row

查看:67
本文介绍了用户追加行后,不会显示文本输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小提琴: http://jsfiddle.net/ybZvv/11/ / p>

我遇到的问题是当你打开小提琴时,如果你点击AH按钮上的几个按钮,然后点击添加问题按钮来追加按钮进入新表格行,表格下方没有文字输入。



但是如果你打开另一个按钮,在表格行中,它会显示该按钮的文本输入。



我的问题是,一旦用户点击添加问题按钮,如何从顶部控件中的打开按钮显示文本输入?



以下是应该发生的事情:


  1. 在顶部控件处,打开按钮A和D.

  2. 单击添加问题按钮,这应该附加一行,但它也应显示按钮A和D的文本输入。


解决方案

我将 btnclick 中的一些代码重构为新方法 updateAnswer ,它收集所有打开的按钮并将输入添加到答案容器。然后从 btnclick insertQuestion 调用该方法。



我更新了 jsFiddle示例


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".

解决方案

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.

这篇关于用户追加行后,不会显示文本输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆