Home >
front end > How to obtain the jquery div inside so the words and content
How to obtain the jquery div inside so the words and content
For example,
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
How to let his alert tip:
Words
XXX. PNG
Words
Words
XXX. PNG
XXX. PNG
Words
Words
XXX. PNG
Words
CodePudding user response:
<body>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
Text & lt;/p>
<script type="text/javascript">
Var boxId=document. GetElementById (" box ");
Var iLen=boxId. Children. Length;
Var STR="";
Var strTmp="";
Var strImg="";
for(var i=0; I
{
Var tag=boxId. Children [I] tagName.
If (tag=="P")
{
StrTmp +=(boxId. Children [I] textContent + "\ r \ n");
}
Else if (tag=="IMG")
{
StrTmp +=(boxId. Children [I] attributes. [0] value + "\ r \ n");
}
}
Alert (strTmp);
</script>