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
ahmed salah
NA
530
148.4k
how to remove item using splice
Sep 7 2016 8:47 PM
in code below i need to using splice in place of remove function
how to do that please
<script>
$(function () {
$(document).on(
"click"
,
".remove"
, function (e) {
e.preventDefault();
$(
this
).closest(
".course-item"
).remove();
});
$(
'#AvailableCourses'
).change(function () {
var val = $(
this
).val();
var text = $(
"#AvailableCourses option:selected"
).text();
var existingCourses = $(
"input[name='CourseIds']"
)
.map(function () {
return
this
.value; }).
get
();
if
(existingCourses.indexOf(val) === -1) {
// Not exist. Add new
var newItem = $(
"<div/>"
).addClass(
"course-item"
)
.append(text +
' <a href="#" class="remove" data-id="'
+ val +
'">Remove </a>'
);
newItem.append(
'<input type="text" name="CourseIds" value="'
+ val +
'" />'
);
$(
"#items"
).append(newItem);
}
});
});
</script>
Reply
Answers (
4
)
GridView in jquery
How to find gridview id and bind the data in another partial