fuelux - Fuel UX 3: is element id required for initialization through Javascript? -


i new fuel ux , trying make checkbox work. have following simple page:

<!doctype html> <html lang="en" class="fuelux"> <head>     <meta charset="utf-8">     <title>fuel ux 3</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css">     <link href="dist/css/fuelux.min.css" rel="stylesheet" type="text/css">      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>     <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>     <script src="//www.fuelcdn.com/fuelux/3.11.0/js/fuelux.min.js"></script>   </head> <body>      <div class="checkbox" id="mycheckbox">         <label class="checkbox-custom" id="mycustomcheckbox1">             <input class="sr-only" type="checkbox" value="">             <span class="checkbox-label">custom checkbox unchecked on page load 22234</span>         </label>     </div>     <script>            //javascript initialization goes here     </script>     </body> </html> 

i need initialize checkbox via javascript. following works:

$('#mycustomcheckbox1').checkbox(); 

the following not working:

$('input[type="checkbox"]').each(function(index, item) {     $(this).checkbox(); }); 

or

$('input[type="checkbox"]').checkbox() 

could expert confirm checkboxes must have id if initialized via javascript? or did in wrong way?

please review the documentation. checkbox jquery plugin can bound label, not wrapping div (if present), nor input.

you might try:

$('.checkbox > label').each(function(index, item) {     $(this).checkbox(); }); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -