How Do I Retrieve Text From A Span Tag Inside A Selected Href Tag? December 12, 2022 Post a Comment I'm trying to retrieve the text from a span elementinside a selected href tag. Here is my HTML from a previous example: Solution 1: You just a need a simple class selector: var test = $(".gifttitle.highlight").text(); Copy Solution 2: var test = $('.highlight > .gifttitle').text(); Solution 3: You shold change your code to: $('#capture').click(function(e) { e.preventDefault(); // var test = $(".gifttitle", this).text(); alert("TEXT " + test); }); Copy The :selected pseudoclass is not applied to span elements. The $(". gifttitle ", this) means select the element with class gifttitle in current element. Share Post a Comment for "How Do I Retrieve Text From A Span Tag Inside A Selected Href Tag?"
Post a Comment for "How Do I Retrieve Text From A Span Tag Inside A Selected Href Tag?"