Using if statement in HTML <# session

nickCroat 111 Reputation points
2022-07-15T03:49:16.66+00:00

Hi,

How can I use if statement to check if value is number in html code?
This is example:
<%# funcVPC(strVPC:=Eval("VPC")) %>
I wish to check if funcVPC is numeric or text xxx,xx

Community Center Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 57,826 Reputation points Volunteer Moderator
    2022-07-15T05:34:21.237+00:00

    I am writing this code blindly as you didn't provide any code. You will need to pass the value of this into javascript (as an example) and check if it is a numeric or text.

    Add this to your HTML file:

    <script type="text/javascript">  
      
     var number = funcVPC(strVPC:=Eval("VPC"));  
     if(isNaN(number)){  
     document.write(num1 + " is not a number <br/>");  
     }else{  
     document.write(num1 + " is a number <br/>");  
     }  
      
    </script>  
    

    --------------------

    If this helps please don't forget to mark as correct answer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.