I think you'll be able to figure this out by viewing the jsfiddle https://jsfiddle.net/brendanjackson/zmxrfpas/4/ but just in case. I want the user to input whatever data they choose in the text box. Then choose a table in set one, and click the "submit" button to send it.
<div>
<Div> <h1>
Start
</h1>
Task:<input type="text" id="input_text">
</Div>
<div>
Send to:
<select id="send_to"> <option value="set1table1">set1table1</option> <option value="set1table2">set1table2</option> <option value="set1table3">set1table3</option> <option value="set1table4">set1table4
</option> </select>
</div>
<input type ="button" id = 'submit_button'value="Submit!"/>
</div>
Here's where I run into trouble, when I send that user input information I also send a new drop down select menu and new button to whatever table the user chose. I'm unsure of how to access this information because I don't know how to give it an "ID" or for that matter any way to access it. I NEED to be able to access that information and send it on its way to the next set of tables.
$('#submit_button').click(function(){
input_text = $('#input_text').val();
options_menu = '<select id="options_menu"> <option value="set2table1">set2table1</option> <option value="set2table2">set2table2</option> <option value="set2table3">set2table3</option> <option value="set2table4">set2table4</option> </select>';
index_item = '<input type="submit" name="get" id="get" value="Get selected index" />'
send_to = $("#send_to option:selected");
console.log("index: " + send_to.index() );
var send_index = send_to.index()
switch(send_index){
case 0:
$('#set1_text1').append("<ul>" + "<li>" +input_text+ " " +options_menu+ "" +index_item+ "</li>" + "</ul>");
break;
case 1:
$('#set1_text2').append("<ul>" + "<li>" +input_text+ " " +options_menu+ "" +index_item+ "</li>" + "</ul>");
break;
case 2:
$('#set1_text3').append("<ul>" + "<li>" +input_text+ " " +options_menu+ "" +index_item+ "</li>" + "</ul>");
break;
case 3:
$('#set1_text4').append("<ul>" + "<li>" +input_text+ " " +options_menu+ "" +index_item+ "</li>" + "</ul>");
break;
}
});
Originally (and part of the code is still in the fiddle) I just had the user created menu and button but, that just looked really ugly to me. I also tried using ".live" but I really don't think I quite grasp how it works, nor am I even sure if a solution is possible with it alone.
Surely someone else out there has had trouble similar to this but I'm not really seeing anything quite like it. I've been stuck on this for a while so I'd really appreciate some help. How can I access the information on every object sent to the tables set 1 and send it to one of the tables of set 2?