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
Attie
NA
95
2.3k
CHeckbox to update the database
Mar 9 2018 6:38 AM
Good Day
Yesterday I tried to ask a question but I think I failed to explained what is it that I clearly searching for. I want an uncheck/check all checkbox, that when clicked all the values in the selected checkboxes be stored into the database, when unchecked be removed. Currently I have the checkbox that i working only to check and uncheck but not doing anything to the database (SQL Server).
<script type=
"text/javascript"
>
function
toggleChecked(status)
{
$(
"#checkboxes input"
).each(
function
()
{
$(
this
).prop(
"checked"
, status);
});
}
$(document).ready(
function
()
{
// Changing state of CheckAll checkbox
$(
"#checkboxes"
).click(
function
()
{
if
($(
"#checkboxes"
).length == $(
"#checkboxes input:checked"
).length)
{
$(
"#checkall"
).prop(
"checked"
,
true
);
}
else
{
$(
"#checkall"
).removeAttr(
"checked"
);
}
});
$(
"#checkall"
).click(
function
()
{
var
status = $(
"#checkall"
).prop(
'checked'
);
toggleChecked(status);
});
});
</script>
<b>
<label>
Check/Uncheck All
</label>
<label
class
=
"switch"
>
<input type=
"checkbox"
id=
"checkall"
>
<span
class
=
"slider round"
>
</span>
</label>
</b>
<br />
<div id=
"checkboxes"
style=
"height: 500px;position:relative;border:1px solid darkgray"
>
<div id=
"div2"
style=
"max-height:100%;overflow:auto;"
>
<div id=
"suburbsDiv"
></div>
</div>
</div>
Reply
Answers (
8
)
Free video tutorial editor or software with screen recording
What is the best approach to work with Entity framework