demo.html
viewModel.js
First Name: Last Name:
function ProfileViewModel() { this.profileClosure = ko.observable(false), this.firstName = ko.observable("Alex"); this.lastName = ko.observable("Xaviar"); } myViewModel = { profileVM: ko.observable(), initialize: function () { myViewModel.profileVM = new ProfileViewModel(); ko.applyBindings(myViewModel); } }ko-extensions.js
ko.bindingHandlers.closureMode= { init: function (element, valueAccessor) { var shouldClose = valueAccessor(); if (shouldClose) { disableAll(element); } else enableAll(); }, update: function (element, valueAccessor, allBindingsAccessor) { var shouldClose = valueAccessor(); var allBindings = allBindingsAccessor(); var highlight = allBindings.highlight || false; if (shouldClose){ disableAll(element); } else enableAll(element); if (shouldClose && highlight) { highlightAll(element); } else setToNormal(element); } }; function disableAll(element) { $(element).find('#firstname').attr('disabled', true); $(element).find('#lastname').attr('disabled', true); } function highlightAll(element) { $(element).find('#firstname').addClass('highlight'); $(element).find('#lastname').addClass('highlight'); } function enableAll(element) { $(element).find('#firstname').attr('disabled', false); $(element).find('#lastname').attr('disabled', false); } function setToNormal(element) { $(element).find('#firstname').removeClass('highlight'); $(element).find('#lastname').removeClass('highlight'); $(element).find('#firstname').addClass('normal'); $(element).find('#lastname').addClass('normal'); }
This comment has been removed by the author.
ReplyDeleteThis is such a good post. One of the best posts that I\'ve read in my whole life. I am so happy that you chose this day to give me this. Please, continue to give me such valuable posts. Cheers!
ReplyDeletepython training in tambaram | python training in annanagar | python training in jayanagar
This is a nice post in an interesting line of content.Thanks for sharing this article, great way of bring this topic to discussion.
ReplyDeleteJava training in Marathahalli | Java training in Btm layout
I have been meaning to write something like this on my website and you have given me an idea. Cheers.
ReplyDeleteData Science course in rajaji nagar | Data Science with Python course in chenni
Data Science course in electronic city | Data Science course in USA
Data science course in pune | Data science course in kalyan nagar
This blog is really helpful for me and got a basic knowledge in this topic. Waiting for more updates, kindly keep continuing.
ReplyDeleteEnglish Training Institutes in Bangalore
Spoken English Classes Bangalore
Best English Speaking Course in Bangalore
English Speaking Classes near me
Best English Training Institute in Bangalore
English Coaching in Bangalore
English Learning Center in Bangalore
best hand blender in india
ReplyDelete123movies
ReplyDeleteonline earning whatsapp groups
ReplyDeleteGreat content thanks for sharing this informative blog which provided me technical information keep posting.
ReplyDeleteAWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
I'm very much inspired when I've visited your blog. Your blog is really informative. Hope you will continue with new article.
ReplyDeleteaws training in chennai
aws course in chennai
Great post thanks for sharing this very useful post
ReplyDeleteBuilding Contractors in Chennai
I like this one...more helpful information provided here.I am quite sure I will learn much new stuff right here! Good luck for the next!
ReplyDeleteAzure Training Institute In Hyderabad