zoukankan      html  css  js  c++  java
  • 记录最近工作使用javascript对select[option]的操作

    1:

    数据库取值赋予select选项

        $(function(){
            $("input[name='state'][value='{$store.state}']").attr("checked",'checked');
        }) 
     

    2:

    将select[option]中选中的选项值和文字分别赋予两个input[hidden]输入框

    $("select[class='cate']").change(function(){
        if($(this).find('option:selected').text() != '请选择...')
        {
            $("#cate_name").val($(this).find('option:selected').text());
        }
        else
        {
            $("#cate_name").val('');
        }
    });
     
    $("select[class='state']").change(function(){
        if($(this).find('option:selected').text() != '请选择...')
        {
            $("input[name='state']").val($(this).val());
        }
        else{
            $("input[name='state']").val(0);
        }
    })
  • 相关阅读:
    使用bash编写Linux shell脚本参数和子壳
    开发项目的简单流程(需求、数据库、编码)
    hadoop和Hive的数据处理流程
    数据分析
    模糊聚类分析的实现
    贝叶斯1
    代理猎手
    贝叶斯2
    模糊聚类算法(FCM)和硬聚类算法(HCM)的VB6.0实现及
    C++模板
  • 原文地址:https://www.cnblogs.com/logon/p/3186517.html
Copyright © 2011-2022 走看看