Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
how to select all children elements and their attributes in jQuery

When the document loads I want to get the attribute href of each button under the class playlist.

my HTML code

    <div class="playlist p-5">

  <div class="song p-3">
    <span><button href="song.mp3" class="songlink btn"> song 1<i class="fa fa-play playbtn"></i></button></span>
    <div class="wavetest"></div>
  </div>

  <div class="song p-3">
    <span><button href="song2.m4a" class="songlink btn"> song 2<i class="fa fa-play playbtn"></i></button></span>
    <div class="wavetest"></div>
  </div>
  
  <div class="song p-3">
    <span><button href="song3.mp3" class="songlink btn"> song 3<i class="fa fa-play playbtn"></i></button></span>
    <div class="wavetest"></div>
  </div>

</div>

my jquery code gives me only href of the first button. here is my jQuery code.

 $(document).ready(function(){
  alert($('.playlist').find('button').attr('href'));
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!