Jquery отследить нажатие input
Как отследить нажатие на такую кнопку через jquery?
<input type="submit" name="SomeName" value="submit_value" class="btn btn-primary pull-right" id="test_button" tabindex="2" data-disable-with="someinfohere">
Кнопку желательно заселектить по id + class (если это возможно) Спасибо!
Ответы (2 шт):
Автор решения: humster_spb
→ Ссылка
$('#test_button.btn').click(function(){
alert('Произошло нажатие!');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="submit" name="SomeName" value="submit_value" class="btn btn-primary pull-right" id="test_button" tabindex="2" data-disable-with="someinfohere">
Автор решения: Denis640Kb
→ Ссылка
$('#test_button.btn.btn-primary.pull-right').on('click', function () {
console.log('Кнопка нажата');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="submit" name="SomeName" value="submit_value" class="btn btn-primary pull-right" id="test_button" tabindex="2" data-disable-with="someinfohere">