views:

33

answers:

1

EDIT:

This error happens because in IE6 and IE7 these attributes are required for a textarea element.

Code:

$(document).ready(function () {
    var ASP_txtNotes = 'ctl00_cphBody_txtNotes';
    $("#" + ASP_txtNotes).removeAttr("cols"); // <-- Error here
}

Error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Sat, 23 Oct 2010 03:04:34 UTC


Message: Could not set the cols property. Invalid property value. Enter a value greater than zero.
Line: 1493
Char: 6
Code: 0
URI: http://192.168.1.93/Castle%20and%20Cook%20Redub/JS/jquery-1.4.2.js

IE Version:

8 in compatibility mode
7 <-- this needs to work
6 <-- dont really care much about this version
A: 

Whats ASP_txtNotes? Could you post some more of your code?

Matt
Hi Matt, I added the declaration of the variable. I'm not sure what the remainder of the code would help - there is a ton of it. If i remove this one line, everything works just fine. If I run this in FF it would just fine, in IE8 (non compatibility) it runs just fine.
Justin808
Why do you want to remove the attribute? It looks like it is required in IE so setting it to default is probably a better option depending on what you want to achieve. $("#" + ASP_txtNotes).attr("cols", 1);
sunn0
Is this a table? frame? what?
Matt
@Matt - This is a textarea tag. @sunn0 - I want to remove the attributes because in IE7 they are used rather than the css style information. If I write html by hand <textarea></textarea> its valid in IE7... The issue is I'm not writing the html so I need to remove the attributes after the fact.
Justin808
I see, I believe those attributes are actually required by standards. Ill do some tests and try it out.
Matt
How are you putting the html on the page? Are you doing some ajax thing where you call the html? Can you call that textarea without giving an error? Example can you do something like $("#" + ASP_txtNotes).addClass('someClass');
Matt