KeinHappyAuer February 2016

Adding the clicked li as request parameter

I try to make a link from a form, I have following code:

<form action="details" method="get" id="breadcrumb">
                <button type="submit" id="back" class="btn btn-sm btn-primary">
                    <span class="fa fa-chevron-left"></span> Back
                </button>
                <ol class="breadcrumb">
                  <li onClick="breadcrumb.submit();" id="file">File</li>
                  <li onClick="breadcrumb.submit();" id="format">Format</li>
                  <li onClick="breadcrumb.submit();" id="batch">Batch</li>
                  <li id="payment" class="active">Payment</li>
                </ol>
            </form>

I want to add the id from the clicked li as parameter, so I can pass it to my DetailsControllerServlet.

How do I do that?

Answers


Gwendal February 2016

It is as simple as

<li onclick="breadcrumb.submit(this);" id="file">File</li>

Post Status

Asked in February 2016
Viewed 1,646 times
Voted 13
Answered 1 times

Search




Leave an answer