Javascript 在视图中显示临时div
我想根据我的点击显示一个临时div。例如,当我单击第二行时,第二行后面将显示一个temp div 我的看法是:Javascript 在视图中显示临时div,javascript,Javascript,我想根据我的点击显示一个临时div。例如,当我单击第二行时,第二行后面将显示一个temp div 我的看法是: <div id="sidetree" align="center"> <div id="sidetreecontrol"> <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> </div> <ul class=
<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 } ?>
也许这就是你想要的:
$(yourDiv).click(function(){
$('.tempdiv').remove();
var tempDiv = $("<div/>").attr('class', 'tempdiv').css({"width": "100px". "height":100px"}).appendTo($(this));
});
$(yourDiv)。单击(函数(){
$('.tempdiv').remove();
var tempDiv=$(“”).attr('class','tempDiv').css({“width”:“100px”,“height”:100px“}).appendTo($(this));
});
您面临的问题是什么?
$(yourDiv).click(function(){
$('.tempdiv').remove();
var tempDiv = $("<div/>").attr('class', 'tempdiv').css({"width": "100px". "height":100px"}).appendTo($(this));
});