JS code doesn't work

wiciu2.0 25 Nov, 2012
Hi! I have a problem with JC code. So, I'm including JavaScript Code with Load JS in Events, but this code work only when I click:"Test Form", but doesn't work in page in joomla. When I looked in source pages I saw this same JS code in test page and in site. This code:
var checkbox_id, textbox_id, checkbox, textbox, div;
/* edit the next two lines to match the ids of the elements in your form */
checkbox_id = 'checkbox';
textbox_id = 'wlasna_modlitwa';

window.addEvent('domready', function() {
  checkbox = $(checkbox_id);
  textbox = $(textbox_id);
  div = $(textbox_id+'_container_div');
  div.dissolve();
  showHide();
  checkbox.addEvent('click', showHide);
});

function showHide() {
  if ( checkbox.checked ) {
    div.reveal();
    textbox.disabled = false;
  } else {
    div.dissolve();
    textbox.value = '';
    textbox.disabled = true;
  }
}		
GreyHead 26 Nov, 2012
Hi wiciu2.0,

It sounds as if there is a conflict with some other script on your page. Please use your browser web develop tools to check the JavaScript Console for error messages.

Bob
This topic is locked and no more replies can be posted.