Hi …
I’m going to make “click” event handler for a radio button. The radio button will load from twig template from the server via ajax request . I open a popup and then I run ajax request .every thing is ok but after loading template from the server, click event handler doesn’t work.
The html code that I will load from the server (Twig file) :
<div class="form-group"> <label for="exampleInputEmail1">Type of price</label> <label class="container_radio">Desired price <input type="radio" checked="checked" value="1" id="rnsr_type_of_price1" name="type_of_price" > </label> <label class="container_radio">agreed price <input type="radio" id="rnsr_type_of_price2" value="2" name="type_of_price" > </label> </div> <div class="form-group" id="PriceDiv"> <input type="text" class="form-control price_formatter" id="rnsr_Price" onblur="formatCurrency_Ch('rnsr_Price');" onkeyup="formatCurrency_keyup('', 'rnsr_Price')" name="Price" aria-describedby="Price" placeholder=""> </div>
And my Jquery file is :
$$('#show_register_new_services_request_popup').on('popup:open', function (e, popup) {
$.ajax({
url: ajaxurl,
datatype: 'json',
type: 'POST',
data: {request: 'get_services_terms', 'term_parent': 0},
timeout: timeout,
crossDomain: crossDomain,
success: function (data) {
$("[id^='rnsr_type_of_price']").on('click', function () {
if ($(this).val() == 1) {
$("#rnsr_Price").prop('disabled', false);
$("#rnsr_Rent").prop('disabled', false);
}
.
.
.