简体   繁体   English

从下拉菜单中选择一项后,显示新选项并显示文本?

[英]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.

相关问题 从下拉代码点火器选择选项后显示数据 - display data after selecting options from dropdown codeigniter 从复选框1中选择项目并从dropdown1中选择项目后,结果在dropdown2中显示/隐藏选项值 - result show/hide option value in dropdown2 after selecting item from checkbox1 and selecting item from dropdown1 在下拉列表中选择项目名称后如何显示文本,要显示的文本不是select的值 - How to display a text after selecting an item name in the dropdown list, the text to be displayed is not the value of select 使用 JavaScript 或 Jquery 从选项下拉列表中显示项目 - Display Item from Dropdown of Options with JavaScript or Jquery 从下拉菜单中选择后无法显示值 - Not able to display value after selecting from dropdown 使用vuejs在下拉列表中选择项目后如何显示表单 - how to display form after selecting item in dropdown using vuejs 使用JavaScript从下拉菜单中选择项目 - Selecting item from a dropdown with javascript 从多选下拉菜单中选择选项时如何显示文本框 - How to display a text box while selecting an option from a multiselect dropdown PHP-选择下拉列表后直接从MySQL显示消息 - PHP - Display message from MySQL directly after selecting a dropdown 使用jquery从一个下拉列表中选择选项后启用另一个下拉选项 - Enabling another dropdown options after selecting option from one dropdown using jquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM