techhjork

Untitled

Jun 28th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. jQuery selector not selecting a new addClass() length on function but when i console nodelist[] that is showing the right node length
  2.  
  3. for see more codes :- [Codepen link][1]
  4.  
  5. **nodelist after addclass("") =>**
  6. [![nodelist][4]][4]
  7.  
  8. <!-- begin snippet: js hide: false console: true babel: false -->
  9.  
  10. <!-- language: lang-js -->
  11. $(document).ready(function(){
  12. function next(){
  13. if(i < sections.length -1){
  14. i++;
  15. if(i == sections.length -1){
  16. $('#next_question').hide();
  17. }
  18. $('html, body').animate({
  19. scrollTop: sections[i].offsetTop,
  20. }, 500);
  21. }
  22. }
  23. $("input[name='freqTravel']").click(function(){
  24. var freqTravel = $("input[name='freqTravel']").val();
  25. if(freqTravel === "yes"){
  26. $(".optional_Section_yesoptional").show().addClass("Section");
  27. }
  28. })
  29. })
  30.  
  31. <!-- end snippet -->
  32.  
  33. [1]: https://codepen.io/techhjork/pen/gOPGYbO
  34. [2]: https://i.stack.imgur.com/hNnkP.png
  35. [3]: https://i.stack.imgur.com/pbEA7.png
  36. [4]: https://i.stack.imgur.com/XMuFa.png
Add Comment
Please, Sign In to add comment