title: how to set dynamic value to hidden field on document.ready function
body: <pre><code>&lt;script type="text/javascript"&gt;
  
  
      $(document).ready(function () {
  
          alert($("#hdnDivValue").val());
          var VisibleDiv = $("#hdnDivValue");
          var Task = $("#DF_d-L_Mytaskdiv");
          var TaskReport = $("#DF_d-L_Comptaskdiv");
          var LeaveReport = $("#DF_d-L_LeaveReqdiv");
  
          var btnLeaveMang1 = $("#btnLeaveMang");
          var btnMy_Task1 = $("#btnMy_Task");
          var btn_TaskReport1 = $("#btn_TaskReport");
          //var btnlLeaveSave1 = $("$btnlLeaveSave");
  
  //        btnlLeaveSave1.click(function () {
  //            $("#hdnDivValue").val("DF_d - L_LeaveReqdiv");
  //            alert('working');
  //        });
  
          btn_TaskReport1.click(function () {
  
              //VisibleDiv.val() = "DF_d - L_Mytaskdiv";
              TaskReport.show();
              Task.hide();
              LeaveReport.hide();
  
          });
  
          btnMy_Task1.click(function () {
  
              // VisibleDiv.val() = "DF_d-L_Comptaskdiv";
              TaskReport.hide();
              Task.show();
              LeaveReport.hide();
          });
  
          btnLeaveMang1.click(function () {
  
              //VisibleDiv.val() = "DF_d-L_LeaveReqdiv";
              TaskReport.hide();
              Task.hide();
              LeaveReport.show();
              $("#hdnDivValue").val("DF_d - L_LeaveReqdiv");
              alert($("#hdnDivValue").val());
              //VisibleDiv.val("DF_d - L_LeaveReqdiv");
  
          });
  
  
  
          if (VisibleDiv.val() == "DF_d-L_Comptaskdiv") {
  
              TaskReport.show();
              Task.hide();
              LeaveReport.hide();
              // VisibleDiv.val() = "DF_d - L_Comptaskdiv";
          }
  
          else if (VisibleDiv.val() == "DF_d-L_Mytaskdiv") {
              TaskReport.hide();
              Task.show();
              LeaveReport.hide();
              //VisibleDiv.val() = "DF_d-L_Mytaskdiv";
  
          }
          else if (VisibleDiv.val() == "DF_d-L_LeaveReqdiv") {
  
              TaskReport.hide();
              Task.hide();
              LeaveReport.show();
              //VisibleDiv.val() = "DF_d-L_LeaveReqdiv";
  
          }
  
  
  
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>this is my jquery code : </p>
  
  <p>the logic behind i used through this code is :
      i have three div respectively 
           div1
           div2
           div3
       and i have one hidden field....</p>
  
  <p>intially i set the hidden field value to div3 so div3 is displayed according to the code...</p>
  
  <pre><code>     else if (VisibleDiv.val() == "DF_d-L_LeaveReqdiv") {
  
              TaskReport.hide();
              Task.hide();
              LeaveReport.show();
              //VisibleDiv.val() = "DF_d-L_LeaveReqdiv";
  
          }
  </code></pre>
  
  <p>----- and i have three button also....when i click on first button div1 is displayed and              set the hiddenfield value to div1 id ......my problem is when pageload occurs the hidden field value , set to intial value i.e div3 value instead of div1 i.e  bind respective last button click div id value any body have any idea...to solve this issue....in asp.net we have view state is it any function in javascript to get last valued stored</p>