0

I've got some fields defined by a third party app:

<input type="checkbox" name="eventinstance_set-0-DELETE" id="id_eventinstance_set-0-DELETE">
<input type="checkbox" name="eventinstance_set-1-DELETE" id="id_eventinstance_set-1-DELETE">
<input type="checkbox" name="eventinstance_set-2-DELETE" id="id_eventinstance_set-2-DELETE">

I need to use jQuery see if any of them are checked, but I don't know how to select them.

if I use input[id^=eventinstance_set] it will include multiple non-relevant fields such as this one:

<input type="text" name="eventinstance_set-0-end" id="id_eventinstance_set-0-end">

on the other hand if I use input[id$=DELETE] it would get other nonrelevant fields.

What's the proper way for me to evaluate for id=eventinstance_set-*-DELETE?

Adam Starrh
  • 6,428
  • 8
  • 50
  • 89

1 Answers1

1

You can have multiple attribute selectors, it returns the elements that match all of them.

$("[id^=eventinstance_set][id$=DELETE]")
Barmar
  • 741,623
  • 53
  • 500
  • 612