I have created a simple project in MVC5 (VS2013) to test the functionality of (selectBoxIt) Jquery plugin to style a ComboBox control for selecting site-language. Everything seems configured correctly, but the "ComboBox" is not affected by the new style of selectBoxIt. In details, this is what I did:
In "BundleConfig.cs" added "jquery.selectBoxIt.min.js" and "jquery.selectBoxIt.css" like this:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/jquery-ui-{version}.js", "~/Scripts/jquery.selectBoxIt.min.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css", "~/Content/jquery.selectBoxIt.css"));
In "Views\Home\Index.cshtml" under @section Scripts{} added:
$(function () { $('cultureSelect').selectBoxIt(); });
Where
cultureSelect
is the name of theselect
control.In "Views\Shared\_LoginPartial.cshtml" at the very end, added the following
select
tag to display the combo-box control at the top of the screen:using (Html.BeginForm("SetCulture", "Home")) { <select id="culture" name="culture" class="cultureSelect"> <option value="en-us" @selected("en-us", culture)>English</option> <option value="ar" @selected("ar", culture)>العربية</option> </select> <input type="button" value="*" onclick="this.form.submit()" /> }
NB:
@selected
is a helper function, just to set "selected" word in the right place.
Now, as far as I can see, I tried to follow every single step to configure "selectBoxIt", but with no success! The comboBox control appears but with the standard style. Is there anything I'm missing? Could you please explain what is wrong with my code?