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);
        }
    })
  • 相关阅读:
    通过anaconda进行python多版本控制
    搭建java环境
    windows安装 Microsoft Visual c++
    更改jupyter notebook的主题颜色(theme) 包括pycharm
    linux服务器安装anaconda,然后远程使用jupyter
    根据经纬度坐标计算距离-python
    Redis相关链接
    VBA笔记-参考教程
    用sklearn计算卡方检验P值
    linux创建新用户
  • 原文地址:https://www.cnblogs.com/logon/p/3186517.html
Copyright © 2011-2022 走看看