Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI am working on this jQuery which will eventually populate fields from the Parent field (Features) to the Children fields (Description, address, etc.) within a List Field. I have been able to get the fields to populate in a certain column, but when I change the first row parent, it changes the children field in all the rows.
You can see an idea of what I am working on here: /
Also this is the code I have been working with:
jQuery(document).ready(function($) {
// START Place Jquery in here
$( "select" ).change(function() {
$(this).parent().click(function() {
var str = "";
$( "td.gfield_list_1_cell4 option:selected" ).each(function() {
str += $( this ).text() + " ";
});
$( "td.gfield_list_1_cell5 input" ).val( str );
})
.trigger( "change" );
});
});
Any thoughts on how to target one jQuery Row at a time within the List Field? I've been trying the each() function, but so far no luck.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI am working on this jQuery which will eventually populate fields from the Parent field (Features) to the Children fields (Description, address, etc.) within a List Field. I have been able to get the fields to populate in a certain column, but when I change the first row parent, it changes the children field in all the rows.
You can see an idea of what I am working on here: https://goadrifttravel/00-test/
Also this is the code I have been working with:
jQuery(document).ready(function($) {
// START Place Jquery in here
$( "select" ).change(function() {
$(this).parent().click(function() {
var str = "";
$( "td.gfield_list_1_cell4 option:selected" ).each(function() {
str += $( this ).text() + " ";
});
$( "td.gfield_list_1_cell5 input" ).val( str );
})
.trigger( "change" );
});
});
Any thoughts on how to target one jQuery Row at a time within the List Field? I've been trying the each() function, but so far no luck.
Share Improve this question asked Dec 18, 2018 at 21:44 ParkbumParkbum 231 silver badge3 bronze badges2 Answers
Reset to default 0I am unsure exactly what you are trying to do, your post is somewhat unclear. But from what I can gather, you need to be more specific with your selectors.
For example: $( "td.gfield_list_1_cell5 input" ). That will select multiple rows because each row has a td.gfield_list_1_cell5 with an input in it.
You could do something like...
$(this).parent().find('.td.gfield_list_1_cell5 input').val( str );
Solved it!!! Boy it was tough. The find() definitely helped! Gravity Forms Support gave me some help, but really it as trial and error, and a good night of sleep... Here is the answer in case anyone is interested:
jQuery(document).ready(function($) {
$("tr").live("change", function popstuff() {
var str = "";
$("td.gfield_list_1_cell4 select option:selected").each(function() {
str = $( this ).text();
$(this).closest("tr").find(".gfield_list_1_cell5 input").val( str );
});
})
.trigger( "click" );
gform.addAction( 'gform_list_post_item_add', function ( item, container ) {
popstuff();
} );
});