【发布时间】:2019-08-28 18:14:02
【问题描述】:
我知道如何使用
-var={} 并在其中添加值和名称,但对于我的工作流程,我想要一个包含电子、运动等类别的类别菜单,这样如果我选择运动,其他子类别菜单只会显示不同的运动。我需要使用一种形式动态地完成它,并且值应该在不点击提交按钮的情况下改变
我试过这样的东西
但它只呈现一个菜单
-var selected=''
-var dic ={ 'Sports': 'Sports', 'Tech': 'Tech'};
select.custom-select
option(selected='') Open this select menu
for key,value in dic
option(value=key)=value
selected=value
if selected==='Sports'
select.custom-select
option(selected='') Open this select menu
option(value='1') football
option(value='2') cricet
if selected === 'Tech'
select.custom-select
option(selected='') Open this select menu
option(value='1') Mobile
option(value='2') Tablets
【问题讨论】:
-
你能发布一个你想要的输出html的例子吗?
-
知道了。用jQuerry插件做的
标签: javascript jquery node.js express pug