Can anyone assist with dynamically setting a checkbox in JavaScript?
function updateCheckboxValue(html){
var values = html.split(",");
document.getElementById('fsystemName').value = values[0];
if (values[1] == "true"){
document.getElementById('fUpdateActiveFlag').checked = true;
}
}
I am sending values separated by commas from my controller. When the value is true, I need to check the checkbox.
UPDATE: Whenever there is a change in the dropdown box, it triggers the displayResults method through its return statement:
$('#uINewsSystemList').change(function() {
$.get("/live-application/SystemById", {systemid: $("#systemList").val()}, updateCheckboxValue, "html");
My goal is to update other elements like textboxes and checkboxes. While fsystemName
correctly displays the value, fUpdateActiveFlag
remains unchecked.