[英]Get the substring From the Html file without considering the tags only text
我是WebDevelopment
。 我有一个html文档,将其视为简历,并且是html格式。 例如-html
<p>Mobile: 12345678891
E-mail: <a href="abc@gmail.com">abc@gmail.com</a></p>
<p><b>Career Objective</b></p>
<p>Employment that fully utilizes my experience in Web Site Design & Development and offers the opportunity for career advancement along with the further expansion of IT skills.
</p><p><b>Career Summary
</b></p><p><b>2.1 years</b> of experience in analysis, design and development of client/server, web based application.
现在,在此Now中,我想从该html字符串中获取一个子字符串。 我想在我的网站上获得这个字符串的经验 。 现在,我尝试从subString
方法获取此字符串,我得到了start and end offset
因此,在这里,当我获取innerText
时会发生什么,它不匹配。 那么,如何仅以这种方式获取显示的子字符串? 如果我想给html中存在的每个单词(包括特殊字符和空格)提供ID,那怎么办呢?
首先,您不能将ID分配给非HTML标记的任何对象。 因此,单个单词或字符不能具有ID。
其次,尝试使用包含确切内容的innerHTML
属性。 innerText
仅包含文本,因此索引可以更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.