Ran into the following problem while trying to have a code to
attach a Virtual Keyboard to any user's form:
User clicks a button and my JavaScript changes outerHTML
of say <textarea - adding things like ONCLICK='saveCaret(this)'
etc. and it also tries to save any text that user could've entered
before the button press.
a) Value - (already typed text) is not assigned back
b) outerHTML is still the same - both in alert() text and via
javascript:x=document.body.innerHTML.replace(/</g,'<').replace(/\n/g,'<br>'); document.body.innerHTML = x;The code is simple so I wander whether we have a way to force HTML to be
re-avaluated/re-parsed via a button click
(if I do the same via <script....</scriptline placed above the button
then everything is OK - because HTML is being changed _before_ the
page load is over)
=======================================
function vkb_addAttributes(obj)
{
var obj_value = ""; if (obj.value != "") obj_value = obj.value;
var kA=" onFocus='vkb_txtControl=this;' OnSelect='vkb_saveCaret(this)'";
var obj_HTML = obj.outerHTML;
var pos = obj_HTML.indexOf('>');
var part1 = obj_HTML.substring(0,pos);
var part2 = obj_HTML.substring(pos);
obj.outerHTML = part1 + kA + part2;
obj.value = obj_value;
}
=============================================
Thanks,
Paul