Jack Jack - 3 months ago 23
HTML Question

Add onkeyup attribute to div using a function

I'm trying to add

onkeyup="Preview.Update()"
as an attribute to a
div
.

Is there any way I could do this with a function since the
div
is incorporated into a plugin on Wordpress and I don't want to edit it.

Thanks for any help,

Jack

Answer

Use jQuery

$("#yourDivID").attr("onkeyup", "Preview.Update()");
Comments