I said in my first reply, there are errors in the last else part in the javascript function.
Your code --else ( alert("No div selected."); ) */ }/*
-which should be --else { alert("No div selected."); } }
I fix it, I deleted the else and now it works. Thanks.