Name is the attribute value of the input tag, and jquery provides the attr () method to set/change the property value
$ ("Input:text"). attr ("name");
$ ("Input:text"). Prop ("name"); You can also get properties using the Prop () method
$ ("*[name= ' name ']"). After (' <div>hello world</div> '); Add an element outside the current
How jquery uses the Name property to take a value
Alert ($ ("Input[name= ' inputtest ')"). Val ());
Alert ($ ("input[type= ' text ']"). attr ("id")); This is the value of the ID, easy to remember to write here
$ ("Input[name= ' inputtest ')". each (
function () {
Alert (This). Val ());
}
)
Alert ($ ("Input[name= ' inputtest ')") [0].value];
Alert ($ ("Input[name= ' inputtest ')") [1].value];
Alert ($ ("Input[name= ' inputtest ')"). Get (0). value); You can also get a value here, equal to the two lines above
Alert ($ ("Input[name= ' inputtest ')"). Get (1). value);
- Value by name:
- $ ("input[name=' mobile ']"). Val ()
- Value by ID:
- $ ("#mobile_reg_form"). HTML ()
- The traversal is evaluated by name:
- $ ("input[name=' mobile ']"). each (
- function () {
- Alert (This). Val ());
- }
- )
- Remove input from the form:
- <script type="Text/javascript" language="javascript" charset="UTF-8">
- $ (document). Ready (function () {
- var a=$ ("form input");
- $.each (
- A
- function (Name,object) {
- Alert (name+ ":" +$ (Object). val ());
- }
- );
- });
- </Script>
- To get a value (multiple cases):
- $ ("input[name=' mobile ']") [0].value
- $ ("input[name=' mobile ']"). Get (1). Value
- Add a Delete style-----jquery--------
- To add a style to a label:
- $ ("#id"). AddClass ("style");
- Delete a label's style:
- $ ("#id"). Removeclass ("style");
- Note: the "#id" ID is the corresponding label of the Id,style is the name of the corresponding CSS style
jquery obtains the current value value by Name,id name