아래 코드가 입니다. 입력하지 않으면 div "itemContent" 에 아무 것도 표시되지 않습니다. 디버깅 할 수 있고 적절한 데이터가이 "sucessfil"로 전달된다는 것을 알 수 있습니다. 아무것도 추가 div에 나타납니다! 내 CSS에 문제가 있습니까?Jquery append/html div가 작동하지 않습니다. 잘못된 CSS입니까?
<script type="text/javascript">
function sucessfil(data)
{
$('#itemContent').append(data);
}
function displayItem(param)
{
$.ajax({
url: 'ItemViewer.php?id='+param,
success:sucessfil
});
}
function showItemInViewer(param)
{
el = document.getElementById("ItemViewer");
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
if(param!='')
{
displayItem(param);
}
}
</script>
<style>
#itemViewer
{
visibility: hidden;
position: absolute;
left: 20%;
top: 5px;
width: 500px;
height: 500px;
text-align: center;
z-index: 1000;
background-color:#666
}
#itemViewer div
{
width: 500px;
height: 500px;
background-color: #fff;
border: 1px solid #000;
border-color:#F30
padding: 4px;
text-align: center;
}
</style>
<a href='#' onClick="showItemInViewer('57');" >thrilled</a>
<div id="MoodViewer">
<div id="moodContent">
<img href='#'
onclick="showItemInViewer('');" src="images/Exit.png" align="right"></img>
</div>
'이'태그가 닫히지 않았습니다. 또한 'displayMood' 함수가 없습니다 – diEcho
div 또는 ItemViewer 요소가 html에 없습니다. – KutePHP
@umar, document.get 대신 jumery $ ('# id')를 사용하는 것이 좋습니다. – kobe