What I need is to find an element which have class=”selected” and than assign content of that element to a variable.
<a href="#">This is the content</a>
<a href="#" class="selected">This is the content</a>
<a href="#">This is the content</a>
Any help? Thank you
Use the class operator:
var elementContents = $('.selected').html(); //assuming there is only one element found with the class selectedHope this helped.