P
P
Pavel Inky2015-10-12 13:44:32
JavaScript
Pavel Inky, 2015-10-12 13:44:32

How to make disable only for a certain radio?

Hello everyone, tell me how to make the checkbox (id="parts_clear") inactive if radio id="image_upload" is selected, and if id="parts_upload" is selected, then the checkbox became active again?

<input type="radio" id="parts_upload" class="icheck-input" value="Part_upload" name="upload">
    <input type="radio" id="image_upload" class="icheck-input" value="Image_upload" name="upload">

   <input type="checkbox" id="parts_clear" class="icheck-input" value="Part_clear" name="clearer">

this is not working for me -
$(function() {
  $("[value=Image_upload]").click(
       $("#parts_clear").attr("disabled", true);
   );
 });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Io, 2015-10-12
@inkyrein

Here is https://jsfiddle.net/0qnty8e3/

L
lega, 2015-10-12
@lega

Made an example in Angular Light (if you want to try something more high-level).
Everything is simple here:
1) al-radio="upload" value="Image_upload" -> sets the variable upload="Image_upload"
2) al-disable="upload == 'Image_upload'" -> sets disable if the condition upload = is met = 'Image_upload'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question