我希望你能帮助我:)...我走了。
我有下一个问题,我需要更改表中的一些文本框,但是值取决于选项中的选项,如下所示:
<select id="msgOptions">
<option>option 1</option>
<option>option 2</option>
</select>
的HTML
<table>
<tr>
<td>
<input type="text" id="message" name="message"/>
</td>
</tr>
</table>
所以我的想法是,如果选择了option1 message =“ message1”或如果选择了option2“ message2”。但是重要的是……我从servlet中获取并放入了div。
那有可能吗?我尝试使用jQuery更改方法,但是它不起作用……也许我做得不好。
感谢您的进步,对不起我的英语不好。
我试过了:
$("#opcionServicio").change(function(){ $("esEjecucionCuentaEjecucion").val('hola'); })
就像这样简单:
$("#msgOptions").change(function(){
$("#message").val(this.value) //In this case this is the selected option
//$("#message").val("Other value")
});
另外,如果您使用的是
$("esEjecucionCuentaEjecucion")
您需要指定它是一个类吗?一个ID?否则,您的选择器将找不到任何东西来应用您所设置的值。
班级:
$(".esEjecucionCuentaEjecucion")
ID:
$("#esEjecucionCuentaEjecucion")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句