简体   繁体   English

如何获取包含具有特定值的 text_field 的表的那些 tr?

[英]How to get those tr of a table containing a text_field with a certain value?

I have a table with several rows in which each td has a field, but I need to search for those tr containing the value "Egress" in a text_field.我有一个包含多行的表,其中每个 td 都有一个字段,但我需要在 text_field 中搜索包含值“Egress”的那些 tr。 The value "Egress" is entered by the user and is not specified in the code.值“Egress”由用户输入,未在代码中指定。

I am trying something like this in coffeescript:我在coffeescript中尝试这样的事情:

$('.payroll_novelties tr:has(.types[value="Egress"])').each ->

  cantidad = $(this).find("td:eq(4) input")
  valor = $(this).find("td:eq(5) input").val()

The code works for me but only if the value "egress" is in the code, but it does not work if it is typed by the user.该代码对我有用,但仅当代码中包含“egress”值时才有效,但如果用户键入该值则不起作用。 How can I fix it?我该如何解决?

I have found a solution as follows:我找到了如下解决方案:

$('.payroll_novelties tr').each ->

  if $(this).find("td:eq(3) input").val() == "Egress"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM