iyop45 iyop45 - 1 year ago 51
HTML Question

How do I make plain text act as a button on click?

I was wondering what is the simplest way of making just plain text act as a button (with minimal html). Text:

<li class="indiv-nav" ><a target="_blank" href="/">About</a></li>

I need the text about to perform that of:

<div id="button"><input type="submit" value="Press me please!" /></div>

Sorry if this is a "stupid" question but, I'm still learning and I find it crazy how theres no "simpler" solution than those I found from googling.

Answer Source


<a href="javascript: void(0)" id="button">Submit</a>


        $("#idOfYourForm").submit();  // consider idOfYourForm `id` of your form which you are going to submit


document.getElementById("button").onclick = function(){