This article describes how to obtain the error Cause Analysis and solutions for the internal content of the div. For more information, see section 1. Error description.
2. Error cause
Because an element is added to p, append () is used ();
$ ("# PStyle"). append ("_ Data [I]. name
");
The append contains dynamic data. When the request data is empty, obtain and judge the content in p:
Var pContent = $ ("# pStyle" ).html (); if (pContent = null | pContent. length = 0) {$ ("# pStyle"). append ("");}
During the judgment, I never went into the if. Later I used the console for debugging and found that even if there was no data, p had a lot of spaces and line breaks.
3. Solution
(1) Use JS hiding method
When the requested data is null, no data is displayed. Otherwise, no data is hidden;
(2) request data using JsViews
The above article introduces the Cause Analysis and Solution for getting errors in the internal content of the DIV, hoping to help you.