JQuery has different values for val and atrr ("value", jqueryatrr
When I was working on a project, the data I passed from the background assigned a value to a text box. In the google browser,
No modification was found during the modification, and the reason was finally checked. It turns out that val and atrr ("value" in jQuery are different from those in browsers,
The summary is as follows:
In jquery, val () and atrr ('value' are used. If there is a default value, if val () is used to assign a value, when this value is modified, google cannot obtain the latest value, but ie can,
For atrr ('value', if there is a default value, ie and google can get the latest changes when it is worthwhile to change this value. Currently, tests are conducted on ie and google, and tests are not performed on other browsers. Haha
In jquery, $ (this) val (); is different from thisvalue.
$ (This). val (); there are four overloaded versions
Val () obtains the current value of the First Matching Element.
Val (array) check, select, radio, etc.
Val (function (index, value) sets the value of each matching element.
Val (val) sets the value of each matching element.
This. value gets the dom object value, such as text radio checkbox select.
Jquery $ ("# someid") val (); what is the difference with $ ("some") value? It turned out to be different from debugging to debugging at today?
$ ("# Someid"). val (); this is the jQuery method.
$ ("Some"). value; this does not seem like a jQuery Method
The "$" character is used in jQuery, but not necessarily "$" is jQuery.
For example, "$" in $ ("some"). value ",
I guess it is defined as follows:
Var $ = function (id ){
Return document. getElementById (id );
}