views:

189

answers:

1

I am using a select element to change the search type on a media site (i.e. search by genre, search by artist).

I have created the dropdown and can get the selected option via a variable but now I need to replace the name attribute on the input element with the variable/selected option. I have seen the below code to change the "value", is there anything like this for changing the name attribute on an input element.

$("input[name$='letter']").val("a letter");
+4  A: 

.attr('name', 'blah')

meder