Link to home
Start Free TrialLog in
Avatar of Peter Kroman
Peter KromanFlag for Denmark

asked on

Binding a link

Hi,

I have this page: http://kroweb.dk/gfdev/godser_raw2/

I am trying to bind the two input fields in the form at the top to the link so that the values for column 2 and column 4 goes in the first and second text field respectively. When this works this form will be hidden.

After that I need the two fields to perform a search on the collecting page the links opens.

I have actually got this working on other pages, but for some reason this is not working on this page, and I really don't understand that.

If you want to test it you can write "Kronborg" in the main searchfield (labeled "Søg") on the page, then you will get a table with links in the "Sogn" column that you can click on :)

I have this form (later not displayed):
        <form id="search" style="display:block" target="_blank" method="GET">
          <input type="text" name="sogn" id="sogn">
          <input type="text" name="amt" id="amt">
        </form>

Open in new window


And I have this js:
      $('#list_items').on('click', '#tdata tr > td:nth-child(2) a', function(e) {
        e.preventDefault();
        $('#sogn').val( $(this).parents('tr').find('td:eq(1)').text() ); 
        $('#amt').val( $(this).parents('tr').find('td:eq(3)').text() );
        $('#search').attr('action', $(this).attr('href') );
        $('#search').trigger('submit');
      });

Open in new window


Anybody who can help here?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kroman

ASKER

YOU DID IT :) :)

Thanks a lot leakim971. I have struggled with this one for several days now. Now it works :)