I want to replace the way to put the value in an input to a Bootstrap modal window by Jquery, the traditional way is as follows:
$("#miModalId #MiInputID").val(MiValor);
said code I want to do only with pure Javascript, the code of Jquery works well, but I want to use only Javascript, maybe some suggestion or idea thanks in advance ..!
Update
The question happens when on the same Html page I have 2 input but with the same id, that is, the input example is in a modal window and the same input is in another modal window. p>
Each modal window is used for different actions, Create, Modify, that is why the duplicity of manners.
Modal Create
<div class="modal fade" id="modalCrearPlanCuenta" tabindex="-1" role="dialog" aria-labelledby="modalCrearPlanCuenta">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="{% url 'empresa:crear_plancuenta' %}" method="post" autocomplete="off">
{% csrf_token %}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><span class="badge bg-green">Crear Plan de Cuentas</span></h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="Codigo" class="value_required">Codigo</label>
<input type="text" name="codigo" id="codigo" class="form-control" required>
Modal Modify
<div class="modal fade" id="modalModificarPlanCuenta" tabindex="-1" role="dialog" aria-labelledby="modalCrearPlanCuenta">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="" method="post" autocomplete="off">
{% csrf_token %}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><span class="badge bg-yellow">Modificar Plan de Cuentas</span></h4>
</div>
<div class="modal-body">
<input type="hidden" name="id_plan" id="id_plan">
<div class="form-group">
<label for="Codigo" class="value_required">Codigo</label>
<input type="text" name="codigo" id="codigo" class="form-control" required>
</div>
That's why I'm looking for the way to point to an input specifying the id of this and the modal. thanks