Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics (2014) Creating a Mobile Drop Down Menu Perform: Part 1

Robert Leonardi
Robert Leonardi
17,151 Points

$("#menu").append($select) doesn't work... $("#menu").after($select) works!

for some reason the append($select) doesn't work... but when i changed to after($select) .. it shows up... somehow the code <select> ... </select> inside the div doesn't show up... i even tried hiding the ul's , still doesn't show up.. but when i place AFTER the div menu, it does show up.

// create a select inside menu
var $select = $("<select></select>");
// $("#menu").after($select);
$("#menu").append($select); // SOMEHOW APPEND DOESN'T WORK
// cycle to menu links
$("#menu a").each(function(){
    var $anchor = $(this);
    // add options
    var $option = $("<option></option>");
    // options value to href 
    $option.val($anchor.attr("href"));
    // options text to text link
    $option.text($anchor.text());
    //append
    $select.append($option);
});
// create button 
    // find click to select location
// modify css to hidde links, show button on small width
// hide select and button for higher resolution
// append selected to options according to page

1 Answer

Robert Leonardi
Robert Leonardi
17,151 Points

Never mind. your DOWNLOAD css file and WORKSPACE css file are not the same... i used the WORKSPACE css.. and everything ok

Thanks for the alternative. Ran into the same issue while using my text editor.