Force html change using Javascript

Asked

Viewed 83 times

1

I have a system that needs to change some fields using JS, the problem is that the type is not changing because the system automatically generates css :

Current code:

<div id="div_Contrato__AdicionarParteExtra__" class="field_container" style="position: absolute; white-space: nowrap;top: 183.0px;left: 1069.0px;width: 131.0px;height: 28.0px;" onmouseover="showHideHelp(this, true);" onmouseout="showHideHelp(this, false);">
  <input type="checkbox" name="var_Contrato__AdicionarParteExtra__" errorspan="err_var_Contrato__AdicionarParteExtra__" id="var_Contrato__AdicionarParteExtra__"
    value="false" onchange="changeBooleanCheckboxValue(this)">
    <span>( + ) Adicionar Parte</span><input type="hidden" name="var_Contrato__AdicionarParteExtra__" value="false"><span style="width: 17px; padding-left: 1px;"><img id="help_Contrato__AdicionarParteExtra__" width="16" 
height="16" src="/imagens/icones_final/information_16x16-trans.png" 
title="Adicionar uma parte extra" style="display: none;"></span></div>

Changes in page opening:

  var divAdicionar = document.getElementById('div_Contrato__AdicionarParteExtra__'),
      elementosFilhos = divAdicionar.childNodes;

  elementosFilhos[3].innerHTML = '';
  elementosFilhos[1].type = 'button';
  elementosFilhos[1].value = '(+) Adicionar';
  elementosFilhos[1].className += 'btn btn-success';

The type is not being altered

No answers

Browser other questions tagged

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