I am building a combo box using MVC3. I want to set the selected value in the combo box on a click event from a webgrid. I am setting the value using
$("#trainingCenterString").val($(this).find('td:eq(1)').text());
MVC puts spaces in the combo box values and with the spaces the select doesn’t work. When the spaces are removed the select works. Does jQuery have “like”, “trim” something like that that can be used to set this?
If you looking at just triming the spaces you can try this:
EDIT
Here is a jsFiddle that includes a click event to set the selected index that should help you.