How does jquery or php check whether the dom element is closed?

Source: Internet
Author: User
How does jquery or php check whether dom elements are closed? for example, my dom is complicated & lt; div & nbsp; class = "I _curr_content" & nbsp; style = "DISPLAY: & nbsp; block "& gt; & nbsp; // This div is not closed & lt; how does h3 jquery or php check whether the dom element is closed?
For example, my dom is complicated.


// This div is not closed
Eight super food types that are resistant to stress, eat at pressure!

 



 

As we all know, too much pressure will undermine our eating habits, 2112132123



 

How can php or jquery find the html element that is not closed and add it to it?


Share:
------ Solution --------------------
Read with DOMDocument: loadHTML and write it with DOMDocument: saveHTML
It is automatically completed, but note that the html document must have Flag. if not, add it by yourself.
For example, your section (assuming it is gbk)
$ S = <HTML
// This div is not closed
Eight super food types that are resistant to stress, eat at pressure!

 



 

As we all know, too much pressure will undermine our eating habits, 2112132123



 
HTML;
$ S =' '. $ S;

$ Doc = new DOMDocument;
$ Doc-> loadHTML ($ s );
Echo $ doc-> saveHTML ();
Output

// This div is not closed
Eight super food types that are resistant to stress, eat at pressure!

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.