I'm trying to get an id
of a checkbox. There are several checkboxes on a page that have id
s like: channel_left_restream_ids_42
, channel_left_restream_ids_44
, etc. I need to handle an event when one of those checked and get an id
of the checked.
So for checkbox with code <input type="checkbox" value="42" checked="checked" name="channel[left_restream_ids][]" id="channel_left_restream_ids_42">
and coffescript like this:
$("input[id*=channel_left_restream_ids]").change (e) =>
alert($(this).attr("id"))
I can't get it work. It says undefined
. I've tried a lot of alternatives, none worked. Where am I doing a mistake?
Aucun commentaire:
Enregistrer un commentaire