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);
        }
    })
  • 相关阅读:
    python PIL生成图片
    ubuntu ftp安装配置
    PIL 字体居中显示
    python selenium cookie 转换成 request能用的cookie
    selenium给正在运行的火狐浏览器换代理ip
    python selenium 下载滑块验证码
    java 简单工厂 工厂模式
    java 装饰者模式
    java 观察者模式
    全排列
  • 原文地址:https://www.cnblogs.com/logon/p/3186517.html
Copyright © 2011-2022 走看看