I have this jquery script which suppose to hide/show div element base on the hyperlink that is clicked. I don't know why but it's not working at all. The following is the except of my code.
function hide_current_commoncontainer(commoncontainer){
$(commoncontainer).each(function(){
if(this.is(":visible")){this.hide();}
});
}
function init(){
$("#compose_link").bind("click",function(){
hide_current_commoncontainer(".pmcommoncontainer");
("#composer").show();
return false;
}
);
if(Drupal.jsEnabled){
$(document).ready(init);
}
I've pinpoint the cause and found out that it is show/hide function which is not working. The rest - function calls - are ok. Can anyone tell me where I am doing wrong? Where should I amend my code in order to hide/show div element as the way I wanted.
Ok I found out why $("#composer").show() is not working. It's because I hard-coded the visibility style of those divs to "hidden" and jquery's "show" method can't revert that. Strangely, as opposed to "show" method, "hide" can revert hard-coded "visible" style with no problem. So, to hide/show elements as intended, I either have to use hide/show method combo without no visibility style hard-coding or use css method of jquery and set the visibility style as desire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With