Home > Web Front-end > JS Tutorial > jquery $(this).attr $(this).val method introduction_jquery

jquery $(this).attr $(this).val method introduction_jquery

WBOY
Release: 2016-05-16 17:20:32
Original
1213 people have browsed it

$(this).attr(key); Gets the value of the node attribute name, which is equivalent to the getAttribute(key) method

$(this).attr(key, value); Sets the value of the node attribute, which is equivalent to setAttribute(key, value) method

eg:



var diywidgetid = $('#w_1').attr('diywidgetid'); //Get node attributes The value of

$(this).val(); gets the value of an element node, equivalent to $(this).attr(“value”);

$(this) .val(value); Set the value of an element node, equivalent to $(this).attr(“value”,value);

eg:

var i_eg=$('#i_eg').val(); // Get the value of the element node
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template