zoukankan      html  css  js  c++  java
  • [ jquery 方法val([val|fn|arr]) ] 此方法获得匹配元素的当前值,常应用于表单元素,select....

    获得匹配元素的当前值,常应用于表单元素,select....,可读可写

    实例:

    <!DOCTYPE html>
    <html lang='zh-cn'>
    <head>
    <title>Insert you title</title>
    <meta http-equiv='description' content='this is my page'>
    <meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- <script type='text/javascript' src='./js/jquery-3.0.0.js'></script> -->
    <script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
    <style type='text/css'>
       input{font:400 13px/20px 'Courier New';color:#000;}
       .addOne{padding:0 8px;}
       .addTwo{color:#999;}
       button[type='button']{font:400 13px/1.2em 'Courier New';padding:3px;}
    </style>
    <script type='text/javascript'>
        $(function(){
            $('button').click(function(){
           alert($('#user').val()); $(
    '#user').val('this is a test'); }); }); </script> </head> <body> <input type='text' id='user' required="required" value='user' class='addOne addTwo'/> <button type='button'>toggleClass</button> </body> </html>
  • 相关阅读:
    anaconda3 notebook for python数据分析-环境搭建
    MySQL之day4
    MySQL之day3
    MySQL之day2
    综合大实验(按需求完成)
    策略路由实验ACL配置
    双点双向重分布实验
    OSPF实验isis协议的设置命令
    OSPFS实验流量优化
    OSPF实验大串连
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5605561.html
Copyright © 2011-2022 走看看