`
fyname
  • 浏览: 55719 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

jquery $(this).attr $(this).val方法

阅读更多
$(this).attr(key); 获取节点属性名的值,相当于getAttribute(key)方法
$(this).attr(key, value); 设置节点属性的值,相当于setAttribute(key,value)方法

$(this).val();获取某个元素节点的value值,相当于$(this).attr(“value”);
$(this).val(value);设置某个元素节点的value值,相当于$(this).attr(“value”,value);
分享到:
评论

相关推荐

    jquery $(this).attr $(this).val方法使用介绍

    获取节点属性名的值,相当于getAttribute(key)方法 $(this).attr(key, value); 设置节点属性的值,相当于setAttribute(key,value)方法 eg:”w_1″ class=”widget” diywidgetid=”${template.diyWidgetId}”>...

    jquery五角星评分效果代码

    self.opt = $.extend(true, {}, $.fn.raty.defaults, settings); $this.data('settings', self.opt); self.opt.number = methods.between(self.opt.number, 0, 20); if (self.opt.path.substring(self.opt....

    jQuery的点击弹出选择头像保存代码.zip

    脚本简介jQuery点击弹出选择头像保存代码是一款个人中心页面经常用到的点击卡通头像弹出设置头像窗口,点击更换头像保存设置代码。 var $box = document....var src=$(this).attr("src"); $(".jide").val(src); })

    Jquery实验报告.doc

    <!... charset=utf-8" /> 无标题文档</title> <script type="text/javascript" src="script/jquery-1.8.1.min.js"></script> </head> ... $("#address").blur(function(){ var txt_value=$(this).val(); if(txt_value==

    Jquery常用方法.txt

    $("img").attr("title", function() { return this.src }); 给某个元素添加属性/值 $("元素名称").html(); 获得该元素内的内容(元素,文本等) $("元素名称").html("<b>new stuff</b>"); 给某元素设置内容 $(...

    图形jquery.gvChart-1.0.1.min.js

    $.print = $.fn.print = function () { // Print a given set of elements var options, $this, self = this; // console.log("Printing", this, arguments); if (self instanceof $) { // Get the node if it...

    jQuery 左侧选项卡菜单点击切换代码.zip

    var val=($(this).next().attr('class')); var menu_value=(val.substring(val.length-1)); $(".container .content .menu" menu_value " .tab:first-child").addClass("active"); $(".container .menu .ulmenu" ...

    JQuery1.3笔记.txt

    $("img").attr("title", function() { return this.src }); 给某个元素添加属性/值 $("元素名称").html(); 获得该元素内的内容(元素,文本等) $("元素名称").html("<b>new stuff</b>"); 给某元素设置内容 $("元素...

    jQuery手机端触屏滑动刻度尺选择数值代码

    var ageVal = $("div[data-page='profile1']").find(".row").eq(0).find(".number").attr("initial-value"); //30-18 var mouVal=$("div[data-page='profil']") $('.ruler .main').eq(0).css({ '-webkit-...

    jQuery完全实例.rar

    Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS), which then finds all matching elements....

    JQUERY 常用方法大全

    JQUERY 常用方法大全 JQUERY 常用方法大全 $(”p”).addClass(css中定义的样式类型); 给某个元素添加样式 $(”img”).attr({src:”test.jpg”,alt:”test Image”}); 给某个元素添加属性/值,参数是map $(”img...

    IAS中文操作手册.zip

    ias = jQuery.ias({ history: false, container: ".content",// 文章列表上一级容器 item: ".excerpt",// 文章列表的类 pagination: ".pagination",// 分页导航父级容器 next: ".next-page a",// 分页导航a...

    jQuery遍历Table应用示例

    $(“#data_table”).find(“tr”).each(function(){ $(this).find(“td input”).each(function(){ if($(this).attr(“name”)==”rid”) { vales+=$(this).val()+”&”; } if($(this).attr(“name”)==”qty”) { ...

    jquery+raphael

    $.fn.jqDrag=function(h){return i(this,h,'d');}; $.fn.jqResize=function(h){return i(this,h,'r');}; $.jqDnR={dnr:{},e:0, drag:function(v){ if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY...

    jquery+事件方法大全

    $("img").attr("title", function() { return this.src }); 给某个元素添加 属性/值 $("元素名称").html(); 获得该元素内的内容(元素,文本等) $("元素名称").html("<b>new stuff</b>"); 给某元素设置内容 $(...

    jQuery详细教程

    jQuery 事件处理方法是 jQuery 中的核心函数。 事件处理程序指的是当 HTML 中发生某些事件时所调用的方法。术语由事件“触发”(或“激发”)经常会被使用。 通常会把 jQuery 代码放到 部分的事件处理方法中: 实例 ...

    密码框显示提示文字jquery示例

    [removed][removed] [removed] $(document).ready(function(){ $(“.text_login”).focus(function(){ if($(this).val()==’user name’ || $(this).val()==’password’){ $(this).val(”); } if($(this).attr(...

    JQuery综合练习2.docx

    1、jQuery 对象可以进行隐式迭代: 为选取的所有的 p 节点都添加了 onclick 响应函数。jQuery 对象本身就是一个 DOM 对象的数组。...加参数为属性节点添加文本值(文本节点),和 text() 类似的方法: attr()、val()

    jquery例子

    $.post("autoCompleteServlet",{word:wordText},function(data){ //把数据转换成jquery对象 var jqueryDom=$(data); //取所有的word节点 var wordNodes=jqueryDom.find("word"); ...

Global site tag (gtag.js) - Google Analytics