I want to add a Jquery to detect a change in any field inside div id="goaldiv" \\ but with below script is not working.
$('#fhcform .goalv input','#fhcform .goalv
select').on('change',function(eve){
alert($(this).val());
});
Below is the html code :
<div id="goaldiv">
<div id="mygoaldiv" >
<div id="my0Div" class="goalv">
<input type="hidden" value="0" name="hddgoal_id[]" class="goalid">
<div class="col-sm-3 col-md-3 col-lg-3 form-pad-bot" class="form-control inputText" >
<select name="goal_id[]" class="form-control " aria-required="true">
<option value=""> Select Goal</option>
<option value="1" > vacation</option>
<option value="2" > child marriage</option>
</select>
</div>
<div class="col-sm-3 col-md-3 col-lg-3 form-pad-bot">
<input value="" placeholder="Goal Year" class="goal_date form-control inputText" type="text" name="goal_date[]" >
</div>
</div>
</div>
</div>
This will make it work, :
$('#goaldiv .goalv input, #goaldiv .goalv select').on('change',function(eve){
alert($(this).val());
});
Your code's selector was wrong,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.