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
sudheen
1.4k
313
83.7k
checkbox with treeview
Sep 10 2015 11:53 PM
(function($)
{
function Tree() {
var $
this
=
this
;
function treeNodeClick()
{
$(document).on(
'click'
,
'.tree li a input[type="checkbox"]'
, function() {
$(
this
).closest(
'li'
).find(
'ul input[type="checkbox"]'
).prop(
'checked'
, $(
this
).
is
(
':checked'
));
}).on(
'click'
,
'.node-item'
, function() {
var parentNode = $(
this
).parents(
'.tree ul'
);
if
($(
this
).
is
(
':checked'
)) {
parentNode.find(
'li a .parent'
).prop(
'checked'
,
true
);
}
else
{
var elements = parentNode.find(
'ul input[type="checkbox"]:checked'
);
if
(elements.length == 0) {
parentNode.find(
'li a .parent'
).prop(
'checked'
,
false
);
}
}
});
};
$
this
.init = function() {
treeNodeClick();
}
}
$(function() {
var self =
new
Tree();
self.init();
})
}(jQuery))
above jquery used for selecting parent node all child node wil be selected.but my requirement is checking child node parent should be selected ..please give me solutions
Reply
Answers (
2
)
convert aspx page data in excel using jquery
How to include a continuous vertical image slider in gridvw