从下拉列表中获取价值,在UrlHelper中使用价值 [英] Get value from dropdownlist en use value in UrlHelper
本文介绍了从下拉列表中获取价值,在UrlHelper中使用价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我会尝试类似的方法,但是这是不允许的.
I would try something like this but it isn't allowed.
function GetDynamicModulesProperties() {
var selectedValue = $("#moduletype option:selected").val();
if (selectedValue.lenght() > 0) {
var url = '<%= Url.Action("GetModuleProperties", new { sectionid = ViewData.Model.Id, moduleTypeId = selectedValue } ) %>';
var renderContainer = $("#modulesettings");
$.get(url, function(data) {
renderContainer.html(data);
renderContainer.fadeIn('slow');
});
}
}
有没有办法做到这一点?
is there a an way to do this?
先感谢
推荐答案
对select执行val()以获取所选的选项值.
do the val() on the select to get the selected option value.
var selectedValue = $("#moduletype").val();
要从选项中获取它,您将使用以下内容,但是多余的按键没有意义:)
to get it from the option you would use the following however there is no point in the extra key presses:)
var selectedValue = $("#moduletype>option:selected").attr('value');
这篇关于从下拉列表中获取价值,在UrlHelper中使用价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文