I have the following function:
<script type='text/javascript'>
$(document).ready(function(){
$("input[name='numeroRg']").blur(function(){
var $nomePaciente = $("input[name='nomePaciente']");
var $dataNascPaciente = $("input[name='dataNascPaciente']");
.....
At the moment, it is being fired when input
which has the name of numeroRG
loses focus
, I would like it to be triggered when the user clicked on button pesquisarName
<form>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="htab1">
<div class="row" style="padding-top: 15px;">
<div class="col-xs-4">
<div class="form-group">
<label for="numeroRg">RG:</label>
<input type="text" class="form-control" name="numeroRg" id="rg" placeholder="__.___.___-_">
</div>
<button class="btn btn-info" name="pesquisarName" id="pesquisarId">Pesquisar</button>
</div>
</div>
</div>
</form>
I've tried to put it like this, but it did not work:
<script type='text/javascript'>
$(document).ready(function(){
$("button[name='pesquisarName']").click(function(){
var $nomePaciente = $("input[name='nomePaciente']");
var $dataNascPaciente = $("input[name='dataNascPaciente']");
.....