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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -