zoukankan      html  css  js  c++  java
  • js和(jQuery)取值(转)

              1: 根据class 、 id  取 input 标签的value 值 。
                      jQuery     : $(".className").val();  $("#idName").val();
                      javaScript : document.getElementById("idName").value;
           
               2:  根据class 、id 获取标签之间的内容:如 <span> 、<lable> 、<div> 。
                     jQuery     : $("#idName").html(); $(".className").html();
                     javaScript : document.getElementById("idName").innerHTML ;
           
              3: 获取<select id='selectId'> <option value='selectValue'>  选中值:
                     jQuery     : $("#selectId").val();
                     javaScript : document.getElementById("selectId").value;
           
              4: 获取<img > 的 src 内容 :
                    jQuery     : $("#imgId")[0].src;
                   javaScript : document.getElementById("imgId").src;
           
              5:子界面获取父界面元素内容:
                     5.1 (标签间的内容 ,如 <span> 、<lable> 、<div> )
                           JavaScript : window.parent.document.getElementById("currentPage").innerHTML ;
                           JQuery     : $(window.parent.document).find("#IdName").text();
                     5.2 (取 input 标签的value 值)
                           JavaScript : window.parent.document.getElementById("currentPage").value ;
                           JQuery     : $(window.parent.document).find("#IdName").val();

  • 相关阅读:
    Swoole 学习笔记 03
    MySQL 索引概念
    MySQL使用存储过程创建百万级别测试数据
    MySQL 慢日志查询的设置
    Hyper中的 Request和Response
    PHPStorm deployment 工具的使用
    Hyperf 命令行
    Hyperf 事件机制
    Hyperf jsonrpc 服务的搭建
    PHPstorm的使用
  • 原文地址:https://www.cnblogs.com/0914lx/p/7922213.html
Copyright © 2011-2022 走看看