Home > Web Front-end > JS Tutorial > jquery gets the value of an element based on its name_jquery

jquery gets the value of an element based on its name_jquery

WBOY
Release: 2016-05-16 16:12:54
Original
1495 people have browsed it

Question:

I want to get the element whose name attribute is test, but this test is assigned to a variable, such as var name='test'; that is, I want to get the element whose name attribute is the variable name. How to write it in jquery?

Answer:

$("input[name=" name "]")

The questions and answers are very simple. As the saying goes, it’s easy for those who don’t know how to do it. Friends who have the same needs can refer to it for their own reference.

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