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
Post a Comment