weixin_33734785 2012-05-28 18:52 采纳率: 0%
浏览 22

JS / AJAX:隐藏/显示选择框

The function disables select boxes that do not match with the main category. I have one main category and two subcategories. Is there a way i can hide and show the subcategories select boxes instead of disabling them?

JS/AJAX

<script type="text/javascript">
var formObject = {
    run : function(obj) {

            obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
            var id = obj.attr('id');
            var v = obj.val();
            jQuery.getJSON('update.php', { id : id, value : v }, function(data) {
                if (!data.error) {
                    obj.next('.update').html(data.list).removeAttr('disabled');
                } else {
                    obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
                }
            });
        }   
}; 
</script>
  • 写回答

1条回答 默认 最新

  • weixin_33747129 2012-05-28 18:56
    关注

    You can use the style='display:none;' attribute. Or using JQuery, $("#subc1").show() / $("#subc2").hide().

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办