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
  • 5,698
  • 7
  • 46
  • 82

1 Answers1

1

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

$("[id^=eventinstance_set][id$=DELETE]")
Barmar
  • 669,327
  • 51
  • 454
  • 560