New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.getJason and dynamically created options in partial view MVC3 #733
Comments
Is the |
I am using Razor syntax and the following statement which does display the options in a select tag:
|
Please read what you just wrote and see if you can understand.. |
This is probably going to sound stupid How do I add interpunction and mark down? I am not familiar with this markup-markdown |
There is a link on the right top of the input field: http://github.github.com/github-flavored-markdown/ |
I added the markdown to your question about the select tag. Please review that reply |
Sorry @allen-628, but I'm having trouble understanding what this issue is about. Please re-open if you're still having the issue and include a fiddle that demonstrates exactly what the problem is. |
I am trying to dynamically create options items for a chosen in a partial view using MVC3. The items are called from the controller through .getJason(). The function is returning a series of options (in this country names and ids). I then use .html(items) to supply chosen with these options. I tried to use $('CountrySelect').chosen() as suggested in issue 363; however, the select element falls back to an html select element rather than the chosen eleement. Any suggestions as to how to retain the chosen element?
I am using JQuery 1.7.2
The list is returned through:
$.getJSON("controller/action", function (data) {
var items;
$.each(data, function (i, country) {
items += "" + country.Text + "";
});
$('.chzn-select').html(items); // 247 country elements retrieved here
});
And then I call--
$("CountrySelect').chosen();
Which results in an HTML select element.
If I use
$('.chzn-select').chosen();
then the chosen element is displayed but the options are empty.
Help would be greatly appreciated.
TIA Allen
The text was updated successfully, but these errors were encountered: