Gustavo Puma
Gustavo Puma

Reputation: 1055

Javascript undefined attribute

I'm new to Javascript and I got this:

I have a GridView with the following event:

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
  foreach (TableCell c in e.Row.Cells)
  {
    c.Attributes.Add("full","false");
  }
}

And in my javascript I have an onClick event for every cell:

if(source.full="false")
{
  ...
  source.full="true";
}
else
{
  ...
  source.full="false";
}

Why is it that source.full is always undefined on the first click?

Upvotes: 1

Views: 323

Answers (1)

Gustavo Puma
Gustavo Puma

Reputation: 1055

I now used getAttribute and setAttribute instead like Simen said and it works very well.

Upvotes: 1

Related Questions