【发布时间】:2018-06-07 09:56:03
【问题描述】:
这是我的代码,它没有选择下拉列表的值。
我尝试了许多不同的方法,但都不起作用
<div class="container" style="height: 0;">
<ul class="psh__dpdw ">
<li class="button-dropdown">
<a class="dropdown-toggle">
something <!-- here should be desplayed the dropdown-menu list when i click -->
<img src="{{theme_url}}/assets/images/arrow-down.png" alt="arrow-down">
</a> {{ content:categories category_group_id="57" class="dropdown-menu" id=""}}
<a href="{{helper:site_url}}something/{{category_id}}/{{url_title}}/{{category_id}}{{entry_id}}" name="alphabet">{{special}}</a> {{ /content:categories }}
<!--<ul class="dropdown-menu">
<li>
<a href="prosecutor-pr.html">Soemthing</a>
</li>
</ul> -->
</li>
</ul>
</div>
<script>
$('.dropdown-menu li').find('a').change(function() {
var dropdown = $(this).closest('.dropdown-toggle');
var radioname = $(this).attr('name');
var checked = 'a[name=' + radioname + ']:checked';
//update the text
var checkedtext = $(checked).closest('.dropdown-menu li').text();
dropdown.find('a').text(checkedtext);
//retrieve the checked value, if needed in page
var thisvalue = dropdown.find(checked).val();
alert(thisvalue);
});
</script>**
你点击下拉菜单的按钮,我想在按钮部分显示值。另外,我正在使用 CMS 代码,有什么建议吗?
我该如何解决这个问题?
【问题讨论】:
-
你能创作小提琴吗?
标签: javascript jquery html dom drop-down-menu