2016-10-05 05:00
浏览 133


I have an input field which is displayed a modal with row records while onclick event is fired of each row of the parent table.

input field is :

str+=  '<td><input type="text" class="form-control input-sm full-width" data-toggle="modal"  name="bed_selections['+num+']" id="bed_selection'+ num +'" num="'+num+'" onclick="showBedSelection(this)" /></td>';

parent table looks like :

enter image description here

modal looks like :

enter image description here

I need to store these data(sno,confirm) to of this input element bed_selections['+num+'] as an array value for back-end processing.

How can i achieve this scenario via js/jquery?

Please tell me your clean solutions.

图片转代码服务由CSDN问答提供 功能建议

我有一个输入字段,显示一个带行记录的模态,而onclick事件则触发父行的每一行 表。


  str + ='&lt; td&gt;&lt; input type =“text”class =“form  -control input-sm全宽“data-toggle =”modal“name =”bed_selections ['+ num +']“id =”bed_selection'+ num +'“num =”'+ num +'“onclick =”showBedSelection( 这个)“/&gt;&lt; / td&gt;'; 



我需要将这些数据(sno,确认)存储到此输入元素 bed_selections ['+ num +'] 作为数组值fo r后端处理。

如何通过js / jquery实现这种情况?


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douran7929 2016-10-05 05:30

    Create a hidden Input for each row in the table. On modal closing Event get the confirm Check boxes values and put them into an Array. With Array.join(",") you can serialize Array to string and Update your hidden Input with the corresponding rowid. On your Backend get the hidden Input Value, Split the string into Array using the comma (,) delimeter and you have yourself an Array.

    打赏 评论

相关推荐 更多相似问题