$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Gravity Forms - jQuery in List Field|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Gravity Forms - jQuery in List Field

matteradmin9PV0评论
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 question

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: /

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 question

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/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 badges
Add a comment  | 

2 Answers 2

Reset to default 0

I 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();             
} );
});

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far