Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have 10 Textboxes, I need to compare each Textbox value with all other Textboxes using jquery, please help me out with sample example.





Thanks & Regards
Mounika.D
Posted
Comments
Ratnamounika 2-Jan-13 5:36am    
var ids = $('input[id*="txtDate"]');

var i = 0;

for (i = 0; i < ids.length; i++) {
// //debugger;

if (ids[i].type == 'text') {
if (ids[i].value == ids[i+1].value)

alert("plz select other date");

return false;
}
}
I am trying to use the above code which i have mentioned, but the loop is not working properly

1 solution

Hi,

You can use something like the following.

To get the multiple textbox values

compare two values in textbox using jquery

Thanks
 
Share this answer
 
v2
Comments
Ratnamounika 2-Jan-13 5:38am    
var ids = $('input[id*="txtDate"]');

var i = 0;

for (i = 0; i < ids.length; i++) {
// //debugger;

if (ids[i].type == 'text') {
if (ids[i].value == ids[i+1].value)

alert("plz select other date");

return false;
}
}

I am trying to use the code which i have mentioned, but it is not working, will you please help me out
[no name] 2-Jan-13 6:20am    
Keep your textbox values in a variable as shown in my 1st link and then use the compare poeration...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900