DOM/[removed] get text after tag

前端 未结 6 904
Happy的楠姐
Happy的楠姐 2021-01-05 00:59

How do I get the text \"there\" that comes after a tag in an html document:

hellothere

I see that the

6条回答
  •  暖寄归人
    2021-01-05 01:30

    You have to first get the a attribute innerhtml then take total innerhtml with using substring you can have your there part ..

    $(document).ready(function () {
    var getA=$("p >a").text();
    var getA=getA.length;
    var takeTotal=$("p").text();
    var result=takeTotal.substring(get);
    alert(result);
    });
    

提交回复
热议问题