[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 989
  • Last Modified:

row.onClick="alert()" when building table using javascript

var row = table.insertRow(0);
row.className = "lb"
row.vAlign="top"
row.onClick="alert()"

i'm trying to modify a table and include an onClick event handler, as far as i can tell this should work

any ideas
0
steve_steele
Asked:
steve_steele
  • 2
1 Solution
 
boblahCommented:
Hi steve_steele,

try

row.onClick=function(){alert();}


Cheers!
0
 
boblahCommented:
steve_steele,

or, if you want to make use of the event arguments:

row.onClick=function(e){alert();}
0
 
cLFlaVACommented:
Just a suggestion:

You should use the all-lowercase versions of the event handlers:

row.onclick = function() {alert();}
0
 
steve_steeleAuthor Commented:
that sorted it thank you very much
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now