Like this, for example: $('input[id$=3]').change(function() { alert('foo'); });
But it really depends on what you want to do. With the above, you'd need to specify as many change() handlers as you have inputs. Another way would be to have a generic handler and, inside that function, have a switch block and test on the last char from the ID. However, in that case, I think you'd be best off preceding the integer with an underscore or some other character. This way, you're not limited to 0-9. $('input[type=radio]').change(function() { var val = $(this).attr('id').split('_'); switch(val[val.length - 1]) { case '1': break; case '2': break; case '3': alert('here it is'); break; // etc. } }); On Sat, Jan 16, 2010 at 1:39 PM, Andre Polykanine <an...@oire.org> wrote: > Hello everyone, > > I need to get a number which is the last char of a radiobutton id. > Say, the IDs are "utype1, utype2, utype3...". I need to say "if the > last char of the Id is 3, then do something". How do I use $= here? > Couldn't find that in the docs. > Thanks! > > > -- > With best regards from Ukraine, > Andre > Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ > jabber.org > Yahoo! messenger: andre.polykanine; ICQ: 191749952 > Twitter: m_elensule > >