css - How can I add an "onclick" in an input tag? -


i trying insert

onclick="countcheckboxes()"  

within input tag. there way in css? tried following, didn't work:

input[type=checkbox]:after { content: "onclick="countcheckboxes()"";} 

so output this

 <input type="checkbox" onclick="countcheckboxes()"> 

this wordpress form. maybe add in functions.php template enable me this?

you cannot generate javascript in css. please refer more information: using javascript in css

i guessing want keep markup clean of js? if so, best thing abstract js markup in separate js file. there can navigate dom , append functions whichever way require. can either vanilla javascript or js framework(like jquery) simplifes process lot.

i'm happy set demo if wish learn how.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -