JSFiddle - React, Tailwind, and code Playground

by suphalak_26

HTML

<input type="text" id="inputTxtId" />
</br>
<div id="chkId">
    <input type="checkbox" value="1">java</input>
    <input type="checkbox" value="2">php</input>
    <input type="checkbox" value="3">jQuery</input>
    <input type="checkbox" value="4">VB</input>
    <input type="checkbox" value="5">C++</input>
</div>

JavaScript

//jQuery('#inputTxtId').keyup(function () {
    var value =[1,4,5]; 
    $('input:checkbox').each(function(index) {     
        for(var i=0; i<value.length; i++){
            if($(this).val() == value[i]){
               $(this).attr('checked', true);
             }
        }			
	});
//});