TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dr.Ajay Kashyap
NA
521
283.7k
javascript find duplicate Stringin array
Feb 8 2017 5:24 AM
javascript find duplicate string in array if there is duplication page not post but after show alert page is post ..so how to avoid
This Is My Code Of Javascript
<script>
$("#category").on('submit', function (e) {
debugger;
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();
if (Category1 == "") {
swal("Category Must Be enter");
return false
}
if (Category2 == "") {
swal("Category Must Be enter");
return false
}
if (Category3 == "") {
swal("Category Must Be enter");
return false
}
if (Category4 == "") {
swal("Category Must Be enter");
return false
}
if (Category5 == "") {
swal("Category Must Be enter");
return false
}
//This Is Code For Duplication
var names = [Category1, Category2, Category3, Category4, Category5];
var uniqueNames = [];
$.each(names, function (i, el) {
e.preventDefault();
if ($.inArray(el, uniqueNames) === -1) {
uniqueNames.push(el);
}
else {
swal("Duplication Not Allow");
return false;
}
});
})
</script>
Reply
Answers (
2
)
Google API to access Delegated mail box email
Asp.Net MVC Student Attendence