Required attribute in an input text javascript

1

I want to put the required attribute in this input created in javascript

  // Celula 4 -Local
    // Cria um <td>
    var locall = row.insertCell(4);
    // Cria o input
    var local = document.createElement('input');
    // Input do tipo texto
    local.type = 'text';
    local.name = 'local[]';
    local.id = 'local';
    local.placeholder='Local';
    local.title = "Local";
    local.className = "form-control";
    locall.appendChild(local);
    
asked by anonymous 24.05.2016 / 12:00

1 answer

1

To do this, then put the statement:

local.required=true;
    
24.05.2016 / 12:04