[英]After selecting an item from dropdown, display new options and show text?
What I want to do is, have a dropdown list that when you click on a selection, the selection will load new options depending on what you clicked on and as well show text or an image below what you have selected. 我想要做的是,有一个下拉列表,当您单击选择时,选择将根据您单击的内容加载新选项,并在选择的内容下方显示文本或图像。 The only real way I can explain it is with a pic I created.
我能解释的唯一真实方法是创建一张照片。
image link here: http://aionhg.com/images/jsq.png (I cant post images as I am a new user, understandable) 图片链接位于: http : //aionhg.com/images/jsq.png (我是新用户,所以我无法发布图片,可以理解)
I have been trying to figure it out in JSFiddle here: http://jsfiddle.net/ZrRZj/1/ 我一直在尝试在JSFiddle中找出答案: http : //jsfiddle.net/ZrRZj/1/
Thank you! 谢谢!
There you go: 你去了:
function setFieldValue() {
var currentVal = $("#Copiers option:selected").val();
$("#field1").val(currentVal);
if (currentVal == "2000") {
$("#img1").replaceWith("<div id='img1'><img src='http://tinyurl.com/d7xeuph'></div>");
} else {
$("#img1").replaceWith("<div id='img1'></div>");
}
}
http://jsfiddle.net/ZrRZj/3/ http://jsfiddle.net/ZrRZj/3/
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.