简体   繁体   中英

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. The value "Egress" is entered by the user and is not specified in the code.

I am trying something like this in 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. 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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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