Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkbox not working with materializecss - HTML, CSS

I can't seem to get checkbox to work whilst using the materializecss, as anyone else came cross this issue and managed to fix it?

The library I am using:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">

Checkbox without library - https://jsfiddle.net/d2yk4sbv/2/

     <div><label> <input type=checkbox> label 1 </label></div>

Checkbox with library - https://jsfiddle.net/d2yk4sbv/

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
            <div><label> <input type=checkbox> label 1 </label></div>

The checkbox seems to be working fine without the library but the problem is, my application depends on using the materializecss so I can't afford to not use it :(

Link to the materializecss website - http://materializecss.com/

like image 577
Jackie Avatar asked Apr 10 '18 16:04

Jackie


People also ask

Can I style checkbox in CSS?

It is possible to style a checkbox using Pseudo Elements like :before, :after, hover and :checked. To style the checkbox the user first needs to hide the default checkbox which can be done by setting the value of the visibility property to hidden. Example 1: Consider the example where HTML checkbox is styled using CSS.

How do you put a checkbox in CSS?

just add the class="checkbox" to your checkboxes. Then create that style in your css code. You will still need to add the class for it to work in IE, and it will not work in other non-IE browsers that do not support IE.

Is materialize responsive?

With materialize, you are provided with several classes to make images and videos responsive to different sizes. The first class is, responsive image. It makes an image resize itself based on the screen size via it is being viewed.

How do you insert a checkbox in HTML?

The <input type="checkbox"> defines a checkbox. The checkbox is shown as a square box that is ticked (checked) when activated. Checkboxes are used to let a user select one or more options of a limited number of choices.


1 Answers

In v1.0.0, checkbox inside label tag with text wrapped around span will only work.

   <label>
        <input type="checkbox" />
        <span>Red</span>
   </label>

https://github.com/Dogfalo/materialize/issues/1376

 <!-- Compiled and minified CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    
    
   Checkbox:  <br/>
   
   <label>
           <input type="checkbox" />
           <span></span>
      </label>
like image 195
Smart Manoj Avatar answered Oct 15 '22 19:10

Smart Manoj