Resize of a square shape

Hi,
I have a square shape drawn with svgCreate(‘rect’)… with length equal to width.How do keep the length equals to width to retain the square share during resize action?

Thanks and Regards
Rajender