address field and text field convert

This commit is contained in:
Matthew K. Fu JuYuan authored and chris committed 2012-11-20 09:53:37 +08:00
1 parent a85e5fcc0d
commit 17988f2fb2
10 files changed
+217 -116

No files matched your search

@@ -0,0 +1,33 @@
function checkSwitch() {
$(".groups").each(function() {
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
});
// $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
}
$(document).ready(function(){
checkSwitch();
$('.onoff').click(function () {
if($(this).parents("h4").length==1) {
$(this).parents(".map-block").toggleClass("disabled");
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
if($(this).parents(".map-block").hasClass("disabled")){
$(this).text("OFF");
}else{
$(this).text("ON");
}
}
if($(this).parents("legend").length==1) {
$(this).toggleClass("disabled");
$(this).parents("legend").next("div").toggleClass("hide");
if($(this).parents("legend").next("div").hasClass("hide")){
$(this).text("OFF");
}else{
$(this).text("ON");
}
checkSwitch();
}
return false;
});
});