Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

Input field visibility through JavaScript

by June 1, 2012 APEX, JAVASCRIPT, Visual Force
Requirement: Our client has a requirement input field should be visible only when check box enables otherwise this input field remains hidden.
Description: We have visual force which contains lots of input field and check boxes. We had requirement user should select one of checkbox and one of input field should be visible.
Visual force page:
function checkfieldStatus(lbltag,txtboxtag)
      var elelbl = document.getElementById(lbltag);
      var eletxt = document.getElementById(txtboxtag);
      if( == “block” && == “block”)
      { = “none”; = “none”
      { = “block”; = “block”;
 As above visual force page having JavaScript code which called on click of Check box. We are passing the id of input field and label. We can see the JavaScript id view source of page.

cheap antivirus software download if (1==1) {document.getElementById(“link47952″).style.display=”none”;}