Can this code be written in a one-line format?
if ($('#sIsTopNav').text().trim() === 'True') {
$('#chkIsTopNav').attr('checked','checked');
}else {
$('#chkIsTopNav').removeAttr('checked');
}
TIA ..
Can this code be written in a one-line format?
if ($('#sIsTopNav').text().trim() === 'True') {
$('#chkIsTopNav').attr('checked','checked');
}else {
$('#chkIsTopNav').removeAttr('checked');
}
TIA ..
Try using conditional (ternary) operator,
$('#sIsTopNav').text().trim() === 'True' ? $('#chkIsTopNav').attr('checked','checked') : $('#chkIsTopNav').removeAttr('checked');