I have some array, received from similar “a” elements.
links = jQuery('a');
How can I get string with href destination and content? Something like:
<a href="/dest1">First</a>
<a href="/dest2">Second</a>
need =>
/dest1 First, /dest2 Second
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
map()andjoin():Demo: http://jsfiddle.net/t4nr5/
.map()iterates over your matched elements;returnreplaces the element with the string that you returned (in the object)..get()converts the returned jQuery object into the underlying JS object, which is an array in this case..join()joins the parts together.