Adding multiple class tags to MVC HTML helper

asp.net-mvc, html-helper, jquery

Solution

Close:

@Html.TextBoxFor(x => x.Name, new { @class = "class1 class2" })

...produces the following HTML:

<input class="class1 class2" data-val="true" data-val-required="Name is required" id="Name" name="Name" type="text" value="">

Problem

I need to assign multiple classes to an MVC TextBox HTML helper, so it functions the same as when assigning multiple classes to an HTML element. i.e.: `<div class="class1, class2"></div>` The following does not work properly: ``` @Html.TextBoxFor(x => x.Name, new { @class = "class1, class2" }) ``` Note: I need to add both class names to a single element in order to trigger different jQuery functions. Any advice would be greatly appreciated.

Original source