In an attempt to abbreviate code and perhaps make it run a touch faster, I tried this code for getting the value if an input whose name is key is a radio button:
var elem = $(':input[name^="'+key+'"]');
currVal = (elem.prop('type') == 'radio' ?
':input[name^="'+key+'"]:checked').val() : elem.val());
I've tried various ways to abbreviate the instruction
':input[name^="'+key+'"]:checked')
but nothing works.
Is there a way of using elem in this situation?
thingsto getwhat?:is correct. That's normally used for pseudo attributes. Try removing it:inputwill match multiple things, such asinput,select,textarea