Attribute required in input text javascript

Asked

Viewed 83 times

1

I intend to put the required attribute in this javascript input

  // 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);

1 answer

1


For that, then put the instruction:

local.required=true;
  • I put the following id as I said and the input disappears

  • Sorry, I had it figured out differently, try it like this.

  • This works, I had already tried, I forgot that the input was button and not Submit , happens

  • Button or radio button?

  • <button type="button" class="btn btn-Primary" id="guardarEvento"><span class="glyphicon glyphicon-ok" Aria-Hidden="true"></span> Save</button>

  • No problem, already changed :)

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.