在选择组合框后显示复选框 [英] Display checkbox after select combo box

查看:101
本文介绍了在选择组合框后显示复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些想法在这里..我想使用组合框进行搜索功能。在用户从组合框中选择了某个值之后...基于所选值复选框将会出现...

示例...

<组合框> - >选择1.user
2.item
3.tag

当用户选择用户



复选框如下将显示



复选框 - 更新用户复选框 - 删除用户



等等......这样可以过滤更多..并且使用户很容易从他们的搜索中查找/查看他们想要的内容......



如果你有其他的想法..而不是使用组合框和复选框..请让我知道..



thankssssssss :)

解决方案

为您的选择列表提供一个ID。

使用jQuery:

  $(document).ready(function(){
$(#mySelect)。change(function(){
var selectValue = $(#mySelect)。val();
switch(selectValue){
casesomeValue:
checkbox ='< input type =checkboxname =somethingvalue =something/>'
$(#someDiv)。append(checkbox);
休息;
casesomeOtherValue:
var checkbox ='< input type =checkboxname =somethingvalue =something/>'
$(#someDiv) .append(复选框);
休息;
}
});
});

依此类推。希望你明白。


I need some idea here.. i wanted to make search function using combo box. after user has selected certain value from the combo box...based on selected value checkbox will appears...

example ...

[combo box] -> select 1.user 2.item 3.tag

when user select "user"

checkbox as follow will appears

checkbox- update user checkbox-delete user

and so forth... this to filter more.. and make user easy to find/view what they want from their search...

if you have other idea..instead of using combo box and check box.. please let me know..

thankssssssss :)

解决方案

Give your select list an ID.

Using jQuery:

$(document).ready(function(){
  $("#mySelect").change(function(){
    var selectValue = $("#mySelect").val();
    switch(selectValue){
      case "someValue":
        var checkbox = '<input type="checkbox" name="something" value="something" />'
        $("#someDiv").append(checkbox);
        break;
      case "someOtherValue":
        var checkbox = '<input type="checkbox" name="something" value="something" />'
        $("#someDiv").append(checkbox);
        break;
    }
  });
});

And so on. Hopefully, you get the idea.

这篇关于在选择组合框后显示复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆