本文介绍了jQuery用DropDownList替换文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在另一个DropDownList中选择一个项目之后,我想使用DropdownList更改页面上的文本框(更改的发生是布尔值的确如此).

After selecting an item in a different DropDownList, I want to change a textbox on the page with a DropdownList (the change happens is a bool is true that besides).

$('#InvoiceNumber').replaceWith($(@Html.DropDownList("CategoryId", new SelectList(Model.Categories, "Value", "Text"), "Choose a category")));

但是发生以下错误:

为什么会这样?

推荐答案

尝试一下:

 $('#InvoiceNumber').replaceWith($('@Html.DropDownList("CategoryId", new SelectList(Model.Categories, "Value", "Text"), "Choose a category")'));

这也应该起作用:

 $('#InvoiceNumber').replaceWith('@Html.DropDownList("CategoryId", new SelectList(Model.Categories, "Value", "Text"), "Choose a category")');

这篇关于jQuery用DropDownList替换文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:05
查看更多