-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation error for text() #1244
Comments
The goal was to explain "Use the .val() method, not the .text() method, to set the value of an I don't think it would be good to document what happens when someone uses .text() on an input, despite being told not to do it. The .after() method would be a better choice. |
I understand the intent of course. I do not think this explanation would work, because this is not the documentation for input, but for the |
Whoops, carry on |
So my point above was that it is not desirable to document the behavior of |
It would probably be best indeed, because this is not just an issue with |
Description
The jQuery documentation for
text()
at https://api.jquery.com/text/ states:But this is factually incorrect. jQuery allows a text value to be passed to an input, or any other empty tags such as
<img />
for that matter. The provided content can instead be visible after the element on the console, as a child, although it will not show in the DOM.For example, consider the following HTML chunk:
The following code
will render:
Thus, the statement that ".text() method cannot be used on input elements" is factually incorrect, and maybe should be replaced with ".text() method should not be used on input elements"
Also, it should be added that the text thus provided will be added as a hidden child of the element.
The text was updated successfully, but these errors were encountered: