A
A
abuamr2018-02-05 18:02:34
JavaScript
abuamr, 2018-02-05 18:02:34

How to handle code added by append?

There is such a code, I want to take the value of the option added using append-yes.
What's wrong here? gives an error (Uncaught SyntaxError: Invalid or unexpected token);

jQuery('.single-product-wrapper .summary').append('<select class="input-text credit_select" style="display:inline-block;width:10em;margin-right:4px;vertical-align:text-bottom;-webkit-appearance:menulist-button;"><option value="3">3 мес.</option><option value="6">6 мес.</option></select><a href="/?page_id=2505" class="button color_bg" style="padding:.5rem 2.134em;margin-top:1em;"><span>Купить в кредит</span><br><strong>' + number_price + ' TJS мес.</strong></a>');
jQuery('select').on('change', '.credit_select', function(){
    var wewww = jQuery('.credit_select option[value="3"]').text();
    console.log(wewww);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dartess, 2018-02-05
@abuamr

jQuery('select').on('change', '.credit_select'... - will hang a handler on '.credit_select' nested in 'select', but in the example above they are the same thing.
Rather, it meant jQuery( '.single-product-wrapper .summary').on('change', '.credit_select'...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question