2013-01-03 1 views
0

내 클릭을 기반으로 임시 담당자를 표시하고 싶습니다. 예를 들어 두 번째 행을 클릭하면 두 번째 행 뒤에 임시 div가 표시됩니다.보기에 임시 직원 번호 표시

<div id="sidetree" align="center"> 
    <div id="sidetreecontrol"> 
    <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> 
    </div> 
    <ul class="treeview" id="tree"> 
    <li class="expandable"> 
     <div class="hitarea expandable-hitarea"></div> 
     <a href="?/index.cfm">These are the Sponsors Of <?=$sponsor_id;?></a> 
     <ul style="display: none;"> 
     <?php 
     foreach($Level1Details->result() as $row){ 
     ?> 
     <li id="sponsor_id"><label alt="<?=$row->user_id?>"><?=$row->user_id;?></label></li> 
     <ul><div id="levelTwo"></div></ul> 
     <?php } ?> 

그리고 JS :

$(document).ready(function(){ 
    $('#sponsor_id label').live('click',function() { 
    var sponsor_id=$(this).attr("alt"); 
    alert(sponsor_id); 
    var js={"sponsor_id":sponsor_id}; 
    $.post(url+"loyalty/level2", js, function(data){ 
     $('#levelTwo').html(data.result); 
     }, "json"); 
    }); 
+0

하고 문제가 무엇인지에 직면하고있다? – mithunsatheesh

답변

0

될 수도 있습니다 당신이 원하는 무언가이다 :

이 내이다

$(yourDiv).click(function(){ 
    $('.tempdiv').remove(); 
    var tempDiv = $("<div/>").attr('class', 'tempdiv').css({"width": "100px". "height":100px"}).appendTo($(this)); 
});