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 trialsammarxz
Front End Web Development Techdegree Student 7,815 PointsYou can remove the button?
This one button was not very friendly to the user, you can cut it and still work?
2 Answers
Kevin Powell
9,028 PointsIt took me a bit of digging, but it was worth it, because I agree 100%, having a "go" button makes for some horrible usability.
I removed all the code for my button, since we're getting rid of it anyway, and added this in at the end instead.
$select.change( function () {
$('select option:selected').each( function() {
window.location = $select.val();
})
});
I'm still learning too, but from what I understand, what this does is looks for a change to happen to my select menu. When a change does happen, it runs a function.
The only thing here I'm not sure about if is .each is the right thing to use. It's going to grab the value of each selected option, and then use that to assign the window location... I figure this is fine, since I can only have one selected item at a time anyway.
Kevin Powell
9,028 PointsYou're welcome!
Kevin Powell
9,028 PointsKevin Powell
9,028 PointsHah, go figure this is the next lesson.... I got it sort of right, but over complicated it... the code I put there is a bit redundant.
sammarxz
Front End Web Development Techdegree Student 7,815 Pointssammarxz
Front End Web Development Techdegree Student 7,815 PointsI really did not know haha, thank you!