user3024007
user3024007

Reputation: 283

Requesting object property

How do I extract the '2013' value from this object?

And for future reference, how do I request a list of all properties of a jQ object instead of just getting [Object object] in console when I do console.log(thisYear) in this case?

<div id="parentEle">
  <ul>
    <li id="item1">
      <span class="year">2013</span>

var thisYear = $('#parentEle').first('.year'). ??;

Upvotes: 0

Views: 19

Answers (1)

T McKeown
T McKeown

Reputation: 12847

var thisYear = $('#parentEle').find('.year:first').text();

Upvotes: 2

Related Questions