1
Answer

validation for 5 text box have different values or not

hello Sir ...
i have minmum 1 and maximum 5 textbox and textbox are created dynamic when user click on add button ...now when user click on submit button i want to validate that every textbox have different value if there is same value then show alert same Value not allow.
 
this all i want using javascript / jquery. 
 
I am Storing The Value Like This ...  Now How To Validate 
 
var Category1 = $("input[name='[0].Category']").val();
var Category2 = $("input[name='[1].Category']").val();
var Category3 = $("input[name='[2].Category']").val();
var Category4 = $("input[name='[3].Category']").val();
var Category5 = $("input[name='[4].Category']").val();
 
Answers (1)
0
Joginder Banger

Joginder Banger

NA 10k 490.1k 7y
try this way, first of get all textbox values.
 
 
  1. <Div id="Container">  
  2.     <input type="Submit" id="AddTextBox" value="Add">  
  3. -------Here are my daynamic textbox  
  4.     <input type="text" value='1' id="first" class="daynamic">  
  5.     <input type="text" value='2' id="second" class="daynamic">  
  6.     <input type="text" value='3' id="thrid" class="daynamic">  
  7. </Div>  
  1. var str="";  
  2. var count=$('.daynamic');  
  3.  for (i = 0; i < count.length ; i++) {   
  4.  var temp=count.eq(i)  
  5.  
  6. $('#Container input[type=text]').each(function (id){  
  7.  alert('va');  
  8.    
  9.   
  10. });  
  11. }