我想要练习这个任务的基础知识。选择李,根据选择复制到另一个ul - jQuery
我的任务列表,当你点击一个任务,选择显示(这是基于人们在html)
你选择一个人,然后将任务添加到人微升。
这是我到目前为止有: 小提琴有更多的评论: http://jsfiddle.net/GavinSteele/Cfyjc/
<ul></ul>
任何帮助将是巨大的..代码,或在其任务先做只是方向。
// Click on a task
// Show select with peoples names
// Select a person
// Task is added to that persons ul
$(document).ready(function() {
// populate the select with options
$(".person h4").each(function() {
var optionTexts = [];
optionTexts.push($(this).text());
$('<option>').val(optionTexts).text(optionTexts).appendTo('select');
});
// Get the selected person
var selected = $('select :selected').text();
// Get the HTML of the task selected to append to the persons list
$("#original li").click(function(){
var html = $(this)[0].outerHTML;
$("select").removeClass("hidden");
$(html).appendTo(// THE SELECTED PERSONS LIST);
});
});
'$(this).clone(true).appendTo(...)'?不要使用'outerHTML' – Bergi
你有什么问题?这似乎是一个为我做的 –
嗨,感谢您的答复,对不起,这不是一个为我做的职位。我只需要方向上的帮助。不必为代码,也许只是,为什么你做到了这一点..试试这个..谢谢@Bergi多数民众赞成在我需要的东西 – user1340971