I want to create my own html tag
You really don't.
HTML is a language that allows us to add meaning to text.
This is just some text.
<p>But this is a paragraph, because it has a <p> tag around it.</p>
<input type="submit" value="And this is a form submission button">
This lets computer programs (including traditional web browsers, screen readers for the visually impaired, mobile phones and search engines) interact usefully with HTML, because the tags indicate what each element is.
This only works because everyone in the world has agreed on the meaning of these tags (via the HTML spec).
What you should do is use whatever existing HTML tag best matches the control you have in mind. In the case of a "back button" (which, please note, every web browser in the world already provides), that might be a <button>
tag, or perhaps a link (<a>
). You could also have a look at the Accessible Rich Internet Applications (ARIA) spec to see if any of the control types there fit what you've got in mind.
I'm a bit confused about your explanation for wanting to make a custom HTML tag though:
Because, i want to use it on more than one page
Maybe you don't want to repeat the JavaScript function that should run when the button is clicked? If so, you can put the function into its own file and include it on the pages where you want to use it:
<script src="/myFunction.js"></script>
Then your button can use it like this (very simplified example):
<button onclick="myFunction();"></button>
You can read up more on this here: DOM event handlers.