I want to disable all buttons except the clicked, I'm using jquery. Help please. SOLVED: removing :input inside '.not()'.
HTML
<div id="buttongroup">
<ul>
<li>
<input type="button" id="butDes" class="butFiltro" value="Descripción" />
</li>
<li>
<input type="button" id="butMaq" class="butFiltro" value="Máquina" />
</li>
<li>
<input type="button" id="butDen" class="butFiltro" value="Denominación" />
</li>
<li>
<input type="button" id="butFecEd" class="butFiltro" value="Fecha edición" />
</li>
<li>
<input type="button" id="butFecCie" class="butFiltro" value="Fecha cierre" />
</li>
<li>
<input type="button" id="butOpe" class="butFiltro" value="Operario" />
</li>
<li>
<input type="button" id="butNue" class="butFiltro" value="Nuevo" />
</li>
</ul>
</div>
</div>
JAVASCRIPT
$('input[type=button]').click(function(){
//$('.butFiltro').click(function(){
var getValueButton = this.id;
alert(getValueButton);
$(':input').not('#'+getValueButton).attr('disabled', true);
});
Change var getValueButton = $(this).id;
to var getValueButton = this.id
Also use .prop
instead of attr
,
var $inputBtns = $('input[type=button]');
$inputBtns.click(function(){
var getValueButton = this.id;
$inputBtns.not('#'+getValueButton).prop('disabled', true);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With