How To Hide And Show In My Case Using Jquery?
I am new to jQuery. I have a index.html page,
I would like the feature that when page loaded, 'content' area shows a list: &
Solution 1:
var mylist=$('#carlist');
mylist.change(function(){
mylist.hide();
var container = mylist.parent();
container.find('img').remove();
container.append('<img src="x.jpg" />');
}
Solution 2:
mylist = $('#my-list');
mylist.change(function(){
mylist.hide();
container = $('#content');
container.html('<img ... />');
)};
There are a number of ways, though, to show new content, with append()
for example, in case you don't want to overwrite all the html code inside <div id="content" />
, or using the functions toggle()
or show()
and hide()
if the <img />
is already there.
Also you will have to have in consideration knowing which option was selected inside the change()
function and act accordingly.
Post a Comment for "How To Hide And Show In My Case Using Jquery?"