Google Textarea Resize Bug Fix
This code will let you resize a text area to be smaller than the size they originally started at.
by greatbigmassive
HTML
<textarea cols="30" rows="5" id="hello" onmouseover="TA_start(this.id)" onmouseout="TA_stop(this.id)">This is some text in here</textarea>
JavaScript
function TA_start(id){
var ta = document.getElementById(id);
if(typeof(ta.resizeCheckStarted) == "undefined"){
ta.resizeCheckStarted = true;
ta.resizeUpdated = false;
var cs = window.getComputedStyle(ta,null);
ta.originalH = cs.getPropertyValue("height");
ta.originalW = cs.getPropertyValue("width");
ta.originalM = cs.getPropertyValue("margin");
ta.style.width = ta.originalW;
ta.style.height= ta.originalH;
ta.style.margin= ta.originalM;
ta.resizeCheck = setInterval("TA_checkMe('"+id+"')",100);
}
}
function TA_checkMe(id){
var ta = document.getElementById(id);
if(ta.originalW != ta.style.width || ta.originalH != ta.style.height){
ta.resizeUpdated = true;
ta.originalW = ta.style.width;
ta.originalH = ta.style.height;
ta.style.width="1px";
ta.style.height="1px";
clearInterval(ta.resizeCheck);
}
}
function TA_stop(id,init){
var ta = document.getElementById(id);
if(typeof(init)=="undefined"){
if(typeof(ta.stopResizeCheck)=="undefined"){
ta.stopResizeCheck = setTimeout("TA_stop('"+id+"',true)",500);
}
} else {
clearInterval(ta.resizeCheck);
if(ta.resizeUpdated != true){
delete ta.resizeCheckStarted;
}
}
}