简体   繁体   中英

OnClick working or not in enter key press?

I have a button in my page ,for which i need to track every hit on it

<button id="searchbutton" type="submit" 
onclick="_gaq.push(['_trackEvent','search','Click','FClicks',1.00,true]);" 
name="Søg"></button>

Now what i want to know is weather this onclick script will work on enter press or not? I want to log every click on this button and I am not sure if user presses enter key deos this work or not? Can any one help me out here?

You could take the Javascript out of the onclick event, and place it to the form onsubmit to be sure. It would also help you if you generally place the code you need in a function and call that function in the form's onsubmit .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM