-1

So this is the code!

<a class="gray" onclick="javascript:window.open('https://forms.zohopublic.com/cpmovers/form/Locationupdates/formperma/0e5D2g0E23J372HC4Dek22J43');">Customer Form</a>

What I want to be done is so instead of the submit button. I want it to be the logo, so it can be clickable. I hope I explained myself well. An image turned into a clickable that leads to this whole code.

3
  • 1
    Don't use inline events, attach an external event listener Commented Jun 14, 2017 at 23:01
  • Certainly don't use the javascript: protocol handler. Commented Jun 14, 2017 at 23:09
  • If all you want is an image to be the submit button on a form, see this question. There's a simpler way to do it using <input type='image' .... Commented Jun 14, 2017 at 23:29

1 Answer 1

0

I don't see the image tag... but you need to set an onclick attribute for the image tag example:

<img src='img/name.jpg' onclick='myFunction()'/>

and inside javascript you will have:

function myfunction(){
  document.getElementById('formId').submit();
 }

As i see that link re-directs you to a form, what you will need to do is to position the image where the submit button was and then add the script so when you click the image it will submit the form you have on your page

Sign up to request clarification or add additional context in comments.

13 Comments

it not invalid, if you follow the link he posted it will show you a form, maybe i just need to be more clear but is not invalid code
image isn't a tag, I believe you are thinking of the self closing <img /> tag
Correct @SterlingArcher except the <img> tag does not have or need a closing slash.
@Rob true, although I will argue that some frameworks (React for example) require self closing tags ending slash, but you're right. In regular JS, it's optional.
@SterlingArcher Despite what React or anyone else does, there is nothing in the HTML <img> tag specification saying anything about a closing slash. Never has been.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.