I have a javascript function to which I pass a parameter, and within that function I want to modify an attribute of that parameter, but I do not get it. My code is as follows:
This is the code from which I call my function (which is a dialog box)
mostrarDialogoBorrar([[#{dialogo_confirm_borrar_indice}]], nombreCampo);
This is my function that shows the dialog box, which has two buttons. When I select one of the buttons I want to change the checked attribute of the checkbox that has id = fieldname
function mostrarDialogoBorrar(texto, nombreCampo){
document.getElementById("dialog-confirm-generic").innerHTML=texto;
alert( $( "#nombreCampo" ));
$( "#dialog-confirm-generic" ).dialog({
resizable: false,
height:160,
modal: true,
position: [($(window).width() / 2) - 150, 300],
dialogClass: 'DeleteConfirmDialog',
buttons: {
[[#{dialogo_confirm_table_button_continuar}]]: function() {
$( this ).dialog("close");
},
[[#{dialogo_confirm_delete_button_cancelar}]]: function() {
$( '#' + nombreCampo ).attr('checked', true);
$( this ).dialog("close");
}
}
});
}
The line that does not work is the following:
$( '#' + nombreCampo ).attr('checked', true);