Start New Discussion within our Web Development Community

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//

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.

<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?

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

You can do it like this:

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

input.className = className.replace("int[5]", "int[7]");
This article has been dead for over six months. Start a new discussion instead.