HTML, text, Val

Source: Internet
Author: User

Html

$ ("#topcontent"). HTML ('<href= ' http:www.baidu.com '>hhhh  </a>');    
$ ("#topcontent"). HTML ("HHhH");    

. HTML () is the HTML content used to read the elements (including their HTML tags)

Text

. text () to read plain text content of an element

Val

The. Text () method cannot be used on form elements, while. val () can only be used on form elements

. HTML () is used to read the HTML content of an element, including its HTML tags,. text () is used to read the plain text content of an element, including its descendant elements,. Val () is a value that is used to read the form element's "value". The. and. Text () methods cannot be used on form elements, whereas. val () can only be used on form elements; the. html () method only reads the first element when used on more than one element, and the. Val () method is the same as. html () If it is applied on more than one element. Only the value of the first FORM element can be read, but. Text () is different from theirs, and if. Text () is applied on more than one element, the textual content of all the selected elements is read.

. HTML (htmlstring),. Text (TextString), and. Val (value) Three methods are used to replace the contents of the selected element, and if three methods are applied on more than one element at the same time, the contents of all the selected elements will be replaced.

. HTML (),. Text (),. Val () can use the return value of the callback function to dynamically change the contents of multiple elements.

HTML, text, Val

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.