2016-12-29 15 views
0

asp.netプロジェクトのマスターページは、jquery 1.10.2とjquery-ui 1.10.1を使用しています。 私はjquery 1.12.4とjquery 1.12.1を使用して 'checkboxradio'機能を使用しようとしています。jquery uiの新しいバージョンをマスターページの古いバージョンと併用する

I現在http://www.ipreferjim.com/2011/06/loading-newer-versions-of-jquery-and-jquery-ui-noconflict/から見つけ、これを、持っているが、それはまだ私がヘッダに

Uncaught Error: No label found for checkboxradio widget...

を得る権利として動作していないようです(また、身体の後にこれを試してみました)

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     var $jQuery = jQuery.noConflict(true); 
     jQuery = $jQuery; // forces the new jQuery into global 

     jQuery(function ($) { 
      $.getScript('https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', function() { 
       $("input[type='checkbox']").checkboxradio(); 
      }); 
     }); 
    </script> 

体内

<label for="checkbox-nested-1">Heavy Metal<input type="checkbox" name="checkbox-nested-1" id="checkbox1"></label> 
<label for="checkbox-nested-1">Rap<input type="checkbox" name="checkbox-nested-1" id="checkbox2"></label> 
<label for="checkbox-nested-1">Pop<input type="checkbox" name="checkbox-nested-1" id="checkbox3"></label> 

ありがとうございました!

+0

'for'属性を変更して、name属性の代わりにid属性を使用するようにしてください。 – Bindrid

+0

は役に立たなかったようです。私のチェックボックスをjqueryui.comのサンプルに置き換えても、それはうまくいかなかった。 –

答えて

1

enter image description here

それは、すぐに私は私のコメントで述べたように、IDを使用するように変更して私のために働き始め。

 <!DOCTYPE html> 
     <html> 
      <head> 

       <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> 
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script> 
       <script type="text/javascript"> 
      var $jQuery = jQuery.noConflict(true); 
      jQuery = $jQuery; // forces the new jQuery into global 

      jQuery(function ($) { 
       $.getScript('https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', function() { 
        $("input[type='checkbox']").checkboxradio(); 
       }); 
      }); 
       </script> 
      </head> 
      <body> 
       <label for="checkbox1">Heavy Metal<input type="checkbox" name="checkbox-nested-1" id="checkbox1"></label> 
       <label for="checkbox2">Rap<input type="checkbox" name="checkbox-nested-1" id="checkbox2"></label> 
       <label for="checkbox3">Pop<input type="checkbox" name="checkbox-nested-1" id="checkbox3"></label> 
      </body> 
     </html> 
関連する問題