Differences between jQuery's val and atrr ("value") Assignment

Source: Internet
Author: User

Differences between jQuery's val and atrr ("value") Assignment

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.