I am having trouble with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<input value='test' type='text' readonly='readonly'
onfocus='this.readOnly = false;'
onblur='this.readOnly = true;'></input>
</body>
</html>
In FF, this works as I would expect. When clicking on the input, the readOnly
property is set to false and the focus is given to the element, with the
cursor placed after the last character.
In IE, the readOnly property is set to false, but the element isn't actually
given focus. Instead, I have to click on the input a second time in order to
actually input text with the keyboard.
Is there a way to make this work the same in IE as it does in FF? I have
tried things like calling this.focus() and this.click() after setting
readOnly to false, but they have no effect.
Any help would be greatly appreciated.
Thank you,
- J.