css - Need help understanding jQuery syntax order of operation -


so far i've been trying descramble other people's code , methods deploying effective , elegant jquery, i'm given options later confuse me should paying attention to. devolves few calls i'm sure can simplified.

what i'm trying is

1-check if id has particular declaration name (the id name),

2-remove controlbar class if not end m4v or

3-if #postvideo empty, or if plain'ol not exist in parent div of articlepost hide .controlbar

4-but if end in m4v, detach , append , it's element attributes element #fold-above... simple right? know, not.

sample code i'm trying work with:

$('#postvideo').not('[src$=".m4v"]').empty().each(function() {      $(".controlbar").remove();  //elements src doesn't end `.m4v` });  $('.articlepost').empty('$("#postvideo").function() {     $(".controlbar").remove(); });  $("#postvideo").detach().appendto("#fold-above"); 

same id, multiple calls. can explain how , why better put of concise code?

$(".controlbar").remove(); remove items class controlbar - same each time. no need use each , if want remove class try instead

$('#postvideo .controlbar').not('[src$=".m4v"]').each(function() {   $(this).empty().removeclass("controlbar"); }); 

or shorter arun showed...


Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -