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?
Peter KromanSales ExecutiveAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
      $(document).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') );
        alert("do you see it work ?"); // remove this line once you done
        $('#search').trigger('submit');
      });

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter KromanSales ExecutiveAuthor Commented:
YOU DID IT :) :)

Thanks a lot leakim971. I have struggled with this one for several days now. Now it works :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.