1
Good morning
I’m using a paginated modal with datatable
, and when I search or change page the function stops to add the person in the main page.
Javascript function
$(function() {
$('.add').click(function(e) {
e.preventDefault();
var vId = $(this).parent().parent().find("#id").text();
var vPessoa = $(this).parent().parent().find("#pessoa").text();
//alert(vId + '/' + vPessoa)
$('#idforn01').attr('value', vId);
$('#forn01').attr('value', vPessoa);
// document.getElementById('forn01_teste').innerHTML = vPessoa;
});
});
Tacio, thanks, but gave this error Uncaught Referenceerror: element_pai is not defined
– frodrigues
This [element_pai] you must replace with a parent element in your code. I will edit my answer for better understanding
– Tácio Brito
I got my data table id like this <script type="text/javascript"> $('#mytable01'). on('click', '.add', Function(e){ e.preventDefault(); var Vid = $(this).Parent().Parent().find("#id").text(); var vPessoa = $(this).Parent().Parent().find("#person").text(); Alert(Vid + '/' + vPessoa) }); </script>
– frodrigues
Worked thanks
– frodrigues
Great, I hope you got the idea. We’re here to help!
– Tácio Brito
I got it Thank you very much.
– frodrigues
Do not forget to leave as solved. Thanks!
– Tácio Brito
Not to impose, I’m new here as I do to leave as solved?
– frodrigues
At the beginning of my reply, there will be an icon like a check right in the left corner, just click on it
– Tácio Brito