I want khổng lồ submit a form. But I am not going the basic way of using a đầu vào button with submit type but a a liên kết.

The image below shows why. I am using image links to lớn save/submit the form. Because I have standart css markup for image link I don"t want khổng lồ use đầu vào submit buttons.

Bạn đang xem: Cara Mengirim Url Situs Ke Google Search Console

I tried khổng lồ apply onClick="document.formName.submit()" to lớn the a element but I would prefer a html method.


Any ideas?


Two ways. Either create a button và style it so it looks like a links with css, or create a link and use onclick="this.closest("form").submit();return false;".


You can"t really bởi vì this without some size of scripting to lớn the best of my knowledge.

submitExample from Here.

Xem thêm: Nhân Viên Content Marketing Là Gì, Bảng Mô Tả Công Việc Nghề Content Marketing


.link-button background: none; border: none; color: #1a0dab; text-decoration: underline; cursor: pointer;


Definitely, there is no solution with pure HTML lớn submit a size with a liên kết (a) tag. The standard HTML accepts only buttons or images. As some other collaborators have said, one can simulate the appearance of a link using a button, but I guess that"s not the purpose of the question.

IMHO, I believe that the proposed và accepted solution does not work.

I have sầu tested it on a size và the browser didn"t find the reference to lớn the size.

So it is possible to solve it using a single line of JavaScript, using this object, which references the element being clicked, which is a child node of the khung, that needs khổng lồ be submitted. So this.parentNode is the khung node. After it"s just calling submit() method in that khung. It"s no necessary research from whole document lớn find the right form.

Enter your name

First Name Last Name Submit hereSuppose that I enter with my own name:


I"ve sầu used get in form method attribute because it"s possible khổng lồ see the right parameters in the URL at loaded page after submit. solution obviously applies lớn any tag that accepts the onclichồng event or some similar sự kiện.

Xem thêm: Hướng Dẫn Sử Dụng Quick Selection Tool, Hướng Dẫn Tách Ảnh Ra Khỏi Nền Bằng Photoshop

this is a excellent choice khổng lồ recover the context together with sự kiện variable (available in all major browsers and IE9 onwards) that can be used directly or passed as an argument to a function.

In this case, replace the line with a tag by the line below, using the property target, that indicates the element that has started the sự kiện.