1

I'm trying to get the html of entire anchor tag but it returns only <span> tag html.What am I missing ?

getDetails = function (ord_id) {
                var $a = $('a[data-ord_id^=' + ord_id + ']');
                console.log($a.html());            
};    

 <a aria-role="button" class="boxSizing" data-businesslocaltime="05/05/2020 11:32 PM" data-business_id="1" data-completedstage="0" data-deferdue="5/5/2020 11:17:27 PM" data-ord_id="462724" data-refnum="R60152" data-timestamp="5/5/2020 10:32:40 PM" onclick="getDetails('462724','0');" role="listitem"><span class="material-icons boxSizing"></span><span class="ordtype boxSizing">Pick Up</span><span class="ordtime boxSizing"> placed @ 11:32 PM, May 05 2020</span></a>

Result

<span class="material-icons boxSizing"></span><span class="ordtype boxSizing"></span><span class="ordtime boxSizing"> placed @ 04:12 PM, May 05 2020</span>
matthias_h
  • 11,356
  • 9
  • 22
  • 40
Ris
  • 1,152
  • 7
  • 29
  • 63

1 Answers1

1

Did the trick,

var $a = $('[data-ord_id^=' + ord_id + ']');
console.log($a.get(0).outerHTML);
Ris
  • 1,152
  • 7
  • 29
  • 63