I know it is very simple but I didn't get it right. Would someone help me. I need to get the hidden field value but it looks like I didn't get the element. The function is run because the alert box show 'run'. The alert in if statement didn't execute. I searched website Check if element exists in jQuery [duplicate] . I still find nothing what is wrong on my code. Would someone help me. Thanks.
There is my hidden field:
<asp:HiddenField ID="hdID" runat="server" value="hd"/>
The jQuery function:
function showMe() 
{
   alert('run');
   if ($('#hdID').length){
      alert( $('#hdID').val()); 
   } else {
      alert('no element'); 
   }
}
 
     
     
    