Home >Web Front-end >JS Tutorial >An introduction to the difference between jQuery's assignment to val and atrr('value')_jquery

An introduction to the difference between jQuery's assignment to val and atrr('value')_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:35:231063browse

When I was working on a project, the data I passed from the background was assigned to a text box through the Google browser

When I made the modification, I found that there was no modification. Finally, I checked the reason. It turned out to be the difference between val and atrr("value" in jQuery on the browser,

So the summary is as follows:
The use of val() and atrr('value' in jquery, assuming there is a default value, if the value is assigned using val(), then when the value is modified, Google cannot obtain the latest value, but ie Yes,
If there is a default value for atrr('value', then when the value is changed, both IE and Google can get the latest changes. Currently, there are no tests on IE and Google, and there is no test on other browsers. Haha

Statement:
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