'get value form array field name

<td>
    <input type="text" id="percent[]" name="percent[]" class="form-control"/>
</td>

How to get value input field like above in Jquery? I tried like this and jquery trigger event doesn't work

$('#percent').change(function(e) {
    var percent = $(this).val();
    var quantity = $('#quantity').val();

    alert(quantity);
    $('#quantity_recipe').val(quantity * percent);
});


Solution 1:[1]

Your selector is different from the id, that you try to select. Either try to change the id or try to escape the braces like this #percent\\[\\]

\\ escapes the brackets, so that jQuery know it's a part of the id and not a part of the selector like button[name="explanation"], to select all buttons with the name "explanation".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1