How Do I Retrieve Text From A Span Tag Inside A Selected Href Tag?
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();
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); });
The
:selected
pseudoclass is not applied tospan
elements.The
$(". gifttitle ", this)
means select the element with classgifttitle
in current element.
Post a Comment for "How Do I Retrieve Text From A Span Tag Inside A Selected Href Tag?"