javascript - .show() not working after the class has been hidden() -
so i'm trying show triggered click event after element has been hidden. can't life of me figure out why .show() not working. i've tried can think of. have right following:
function hidearrows(index){ var hiddenid = parseint($(".queuelistdiv .track").first().attr("id"), 10); console.log("hiddenid = " + hiddenid + currentindex) if(index == hiddenid){ console.log("true son") $("#" + hiddenid + " .soundmove").hide(); $("#" + (hiddenid + 1) + " .fa-arrow-up").hide(); } } function showarrows(){ $(".queuelistdiv .track").each(function(){ var otherid = parseint($(this).attr("id")) if (otherid > 1){ $(this).attr(".queuelistdiv .track .soundmove .fa-arrow-up").show() } }) } the html looks this:
<div id="queuelist" class="queuelistdiv col-md-4"> <div class='track' id='this number'> <div class="soundmove"> <i class="moveup fa fa-arrow-up"></i> <i class="movedown fa fa-arrow-down"></i> </div> </div> </div> the callback showarrows after callback hidearrows callback in click event.
this guess, will work. posting answer. let op check , if works, let be, else delete one.
it practise have id not start numbers or made of numbers fully. try adding bit of character in front.
your html must like:
<div id="queuelist" class="queuelistdiv col-md-4"> <div class='track' id='track-{number}'> <div class="soundmove"> <i class="moveup fa fa-arrow-up"></i> <i class="movedown fa fa-arrow-down"></i> </div> </div> </div> and jquery code can be:
function hidearrows(index){ var hiddenid = parseint($(".queuelistdiv .track").first().attr("id"), 10); console.log("hiddenid = " + hiddenid + currentindex) if(index == hiddenid){ console.log("true son") $("#track-" + hiddenid + " .soundmove").hide(); $("#track-" + (hiddenid + 1) + " .fa-arrow-up").hide(); } } function showarrows(){ $(".queuelistdiv .track").each(function(){ var otherid = parseint($(this).attr("id").replace("track-", "")) if (otherid > 1){ $(this).attr(".queuelistdiv .track .soundmove .fa-arrow-up").show() } }) }
Comments
Post a Comment