×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Влад Якуб
Added: Oct 3, 2019 8:36 AM
Modified: Mar 2, 2023 10:36 AM
Views: 4089
Tags: no tags
  1. 'js'    => '
  2.                                 $("pr-question-main x-pad").prepend("<div class=clicktest></div>");
  3.                                 $("pr-question-main [rnum]").not($("[disall]").closest("[rnum]")).each(function() {
  4.                                         var id = ($(this).find(":checkbox").attr("id")) ? $(this).find(":checkbox").attr("id") : "none",
  5.                                                 text = $(this).find("pr-row-title").html();
  6.                                         $(".clicktest").append("<label for=\"" + id + "\">" + text + "</label>");
  7.                                         $(this).css("display", "none");
  8.                                 });
  9.                                 $(":checkbox", ".pr-rows-group").on("change", function(){
  10.                                         var $this = $(this),
  11.                                                 $label = $("[for=\""+$this.attr("id")+"\"]");
  12.  
  13.                                         if ($label.length)
  14.                                         {
  15.                                                 if ($this.is(":checked"))
  16.                                                 {
  17.                                                         $label.addClass("checked");
  18.                                                 }
  19.                                                 else
  20.                                                 {
  21.                                                         $label.removeClass("checked");
  22.                                                 }
  23.                                         }
  24.                                 });
  25.                                 $("[disall]").on("change", function() {
  26.                                         if ($(this).prop("checked"))
  27.                                                 $(".clicktest").css("pointer-events", "none").find("label").addClass("dis");
  28.                                         else
  29.                                                 $(".clicktest").css("pointer-events", "").find("label").removeClass("dis");
  30.                                 })
  31.                         ',
  32.         'css' => '
  33.             .checked {background: #fffa70;}
  34.             .dis {background: none !important;}
  35.             .clicktest { padding: 10px; margin-top: 20px; line-height: 1.2; border: 1px solid grey; font-size: 120%;}
  36.         ',