1.11M Members

values not comparing

 
0
 

HI i have to compare three values but its not working..

alert box is not showing if i m putting less or greater values...i m calling this function on blur...

function validate(value) 
    {


        var minimum = document.getElementById('min').innerText;
        var maximum = document.getElementById('max').innerText;


      // alert(value);

      if( value < mimimum )
      {

         alert('Value is less than minimum value');

      }

      else if(value > maximum )
      {
          alert('Value is greater than maximum value');
      }
      else
      {

      }

    }

 </script>

Regards//

 
0
 

I think your want to make int comparisson, if sou use parseInt(document.getElementById('min').innerText). If it's float, use parseFloat().

Using > and < with string will not do you any good.

 
0
 

yes Sir working..

 
0
 

<input value="-7" class="validate[required,custom[integer],min[5]] text-input" type="text" name="min" id="min" />

here is one more problem..
i wanto use my javascript varible value in above class "validate[required,custom[integer],min[5]]" here like use dynamic number where 5 is using how to do it?

 
0
 

Sorry, I didn't understand what you want. Please rephrase it.

 
0
 

i m getting value from java script..
now i want to use that particular value in input element class
<input value="-7" class="validate[required,custom[integer],min[5]] text-input" type="text" name="min" id="min" />

u can see min[5] i want to use javascript value in min[javascript varible value]

how to do it?
regards

 
0
 

You can do it like this:

var input = document.getElementById('myInputID');
var className = input.className;

input.className = className.replace("int[5]", "int[7]");
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article