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
Abdalla Omran
NA
334
32.4k
Disable Select List options Once Chosen another select List
Mar 10 2021 1:24 PM
I have two selected list
Branch and Warehouse
if i choose value of one of them the onther should be disabled
for example if i choosed a value from Branch then Warehouse should be disbaled and opposite is right .
<
div
class
=
"form-group"
>
<
label
asp-for
=
"Input.Branch"
>
</
label
>
<
select
asp-for
=
"Input.Branch"
id
=
"branch"
class
=
"form-control"
>
<
option
value
=
""
>
--Select Branch--
</
option
>
@foreach (var item in Model.BranchesList)
{
<
option
value
=
"@item.BranchId.ToString()"
>
@item.BranchName
</
option
>
}
</
select
>
<
span
asp-validation-for
=
"Input.Branch"
class
=
"text-danger"
>
</
span
>
</
div
>
<
div
class
=
"form-group"
>
<
label
asp-for
=
"Input.Warehouse"
>
</
label
>
<
select
asp-for
=
"Input.Warehouse"
id
=
"warehouse"
class
=
"form-control"
>
<
option
value
=
""
>
--Select Branch--
</
option
>
@foreach (var item in Model.WarehousesList)
{
<
option
value
=
"@item.WareHouseId.ToString()"
>
@item.Name
</
option
>
}
</
select
>
<
span
asp-validation-for
=
"Input.Warehouse"
class
=
"text-danger"
>
</
span
>
</
div
>
<
button
type
=
"submit"
class
=
"btn btn-primary"
>
Register
</
button
>
</
form
>
JavaScript :
$(document).ready(function () {
$("#branch").change(function () {
if ($(this).val() == "branch") {
$("#warehouse").attr('disabled', 'disabled');
}
else {
$("#warehouse").removeAttr('disabled');
}
});
});
Reply
Answers (
4
)
Orchard CMS in .net core
A project with an Output Type of Class Library cannot be started direc