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

139
Views
how to split video onerror function on error about src and about poster?
<video id='bvid' src='ph/vid.mp4' poster='ph/vposter.jpg' controls></video>

$(bvid).on('error', function(){
    $(this).attr('src', 'ph/vid.mp4');
    $(this).attr('poster', 'ph/vposter.jpg');
});

the above code works, i.e. if any of src or poster attribute is in error - the both are replaced by given values

problem - in case problem is only about poster - src is also replaced - and vice versa

so I want to split this errors, like this

$(bvid).on('error', function(){
    if(error is about src){$(this).attr('src', 'ph/vid.mp4');}
    if(error is about poster){$(this).attr('poster', 'ph/vposter.jpg');}
});

any help?

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!