JSFiddle - React, Tailwind, and code Playground
HTML
<script>
{
"Parameter Change": [
{"Action": "Change parameter on all channel strips",
"Mac": "Option+applicable function (applicable functions listed above)",
"Windows": "Alt+applicable function (applicable functions listed above)"} ,
{"Action": "Change parameter on all selected channel strips",
"Mac": "Option+Shift+applicable function (applicable functions listed directly above)",
"Windows": "Alt+Shift+applicable function (applicable functions listed above)"}
]
}
</script>
JavaScript
//Search Engine Logic
//When search button is clicked var myQuery is assigned the input
$('.PTHK-btn').click(function(){
searchKey();
});
//When user hits enter instead of taps submit button
$('.PTHK-search').submit(function(){
searchKey();
});
//Get search inout value and assign it to var myQuery
function searchKey() {
var myQuery = document.getElementById("input").value;
//Test function
console.log('Searching for: ' + myQuery);
//Load JSON
$.getJSON("json/qData.json",function( data ) {
$.each(data, function( key, value ) {
console.log(key);
//loop through data
for (var i=0;i<key.length;i++){
// if myQuery matches Key
var keyobj = key[i];
if(keyobj.Action.substring(0, myQuery.length) == myQuery){
//if(key === myQuery && key.length === myQuery.length){
console.log('Found Something');
console.log(key)
}
//else if myQuery matches a value
else if(value === myQuery){
console.log('Found Something');
}
//if myQuery matches nothing
else{
console.log('Found Nothing');
}
};//for loop
});//each
});
};//searchKey