Reputation:
in first of rendering page i can use .html()
to setting any string on div, after hide that and show again jquery could not set string.
my problem is set html after hide and show again element.
jQuery:
$('#view_topic').click(function(){
$('#view_port').show();
$('#view_port').html('HELLO');
})
$('[id^="close_"]').click(function(){
$('#view_port').hide('fast');
});
HTML:
<body>
<li id='view_topic' ><a href="javascript:void(0);">VIEW</a></li>
<div id='view_port' class='jqcontextmenu both view_port' >
<div style='position: absolute;top:0px;left: 4px;'><a href='javascript:void(0);'><img src='../UI/images/close.png' id='close_dialogs'/></a></div>
<div id='view_port_table'>
</div>
</div>
</body>
Upvotes: 0
Views: 182
Reputation: 11440
I believe you want something like this:
HTML
<div id='view_topic'>
<a href="#">VIEW</a>
</div>
<div id='view_port'>
<div id='close_dialogs'>
<a href='#'><img src='http://placehold.it/200x200'/></a>
</div>
<div id='view_port_table'>
</div>
</div>
jQuery
$('#view_topic a').click(function(){
$('#view_port').show();
$('#view_port_table').html('HELLO');
return false;
})
$('[id^="close_"] a').click(function(){
$('#view_port').hide('fast');
return false;
});
CSS
#view_port{
display:none;
}
http://jsfiddle.net/daCrosby/gaAMR/1/
Upvotes: 1
Reputation: 40318
There is no element view_topic
use view_port
$('#view_topic').click(function(){
$('#view_port').show();
$('#view_port').html('HELLO');
})
$('[id^="close_"]').click(function(){
$('#view_port').hide('fast');
});
<a href='javascript:void(0);' id="view_topic">view topic</a>
Upvotes: 1
Reputation: 7768
Add an element in your HTML like
<a href='javascript:void(0);' id="view_topic">view topic</a>
$('#view_topic').click() only trigger click of an element with id="view_topic"
Upvotes: 0