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

Want to program drag and drop items to accept correct answers in different categories with submit button

Programmed drag and drop items and categories just don't know the first thing on how to to program correct and incorrect combinations.

2 Answers

Updated to the right formatting Jacob Mishkin .

I would look into using conditional statements to start. Not really sure what you are trying to do, but I think an if statement might help. And Please do not have it minimized.

Thanks for the advice Jacob. Here's some of the code I'm having issues with. I have"users" as my draggables and the droppable zones as my divs:

 <section id="user-levels">
  <h1>Drag and Drop Quiz</h1>
  <div id="unassigned" ondrop="dropUser(this, event)" ondragenter="return false" ondragover="return false">
    <h2>Choices</h2>
    <!--These are all the draggable peices-->
    <a draggable="true" class="user" id="NetBEUI" ondragstart="dragUser(this, event)">NetBEUI</a>
    <a draggable="true" class="user" id="IP" ondragstart="dragUser(this, event)">IP</a> 
    <a draggable="true" class="user" id="AppleTalk" ondragstart="dragUser(this, event)">AppleTalk</a> 
    <a draggable="true" class="user" id="DECnet" ondragstart="dragUser(this, event)">DECnet</a> 
    <a draggable="true" class="user" id="BGP" ondragstart="dragUser(this, event)">BGP</a> 
    <a draggable="true" class="user" id="RGIP" ondragstart="dragUser(this, event)">RGIP</a> 
    <a draggable="true" class="user" id="RIP" ondragstart="dragUser(this, event)">RIP</a> 
  </div>

  <div id="routed" ondrop="dropUser(this, event)" ondragenter="return false" ondragover="return false">
    <h2>Layer 3 Routed Protocols</h2>
  </div>

  <div id="routing" ondrop="dropUser(this, event)" ondragenter="return false" ondragover="return false">
    <h2>Layer 3 Routing Protocols</h2>
  </div>
 <input type="submit" value="Submit Answers" class="sub">
  <div class="clear"></div>
</form>

So far, starting my conditional statement as follows but now I'm stuck:

var routed = #routed
var routing = #routing


if(#routed === "NetBEUI", "IP", "AppleTalk"){
  onclick(submit); 
}
//correct answers for "routed" id div

unfortunately I can't read your code. Can you please format it, so we can take a look at it.