as the title says, I keep getting \"undefined\" when I try to get the id attribute of an element, basically what I want to do is replace an element with an input box when th
Change
var ID = $(this).attr("id");
to
var ID = $(obj).attr("id");
Also you can change it to use jQuery event handler:
$('#race').change(function() { var select = $(this); var id = select.attr('id'); if(select.val() == 'other') { select.replaceWith(""); } else { select.hide(); } });