0
我想根據我的點擊顯示一個臨時div。例如,當我點擊第二行時,一個臨時div將顯示在第二行之後。Display temp div in view
這是我的看法:
<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");
});
和問題是什麼,你所面對? – mithunsatheesh