Hi all!
So my question is, how to target one Row at a time within the List Field when using jQuery? I 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.com/00-test/
Also this is the code I have been working with to make it happen:
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" );
});
});
So… any thoughts on how to target one Row at a time within the List Field with jQuery? I’ve been trying the each() function, but so far no luck. I’ve also been playing with the parent(), and closest(), but I am still very new to jQuery and might not be doing it right.
Thanks!
UPDATE
With the following code, I can now assign a custom/random class HOWEVER, it is assigning it to all future
$("tr").one( "click", function(){
var random = Math.floor(Math.random() * 1000);
$(this).addClass("row" + random);
});
Any idea’s why it is only letting me affect the first row, and not the following ones? It also does this with my population