textbox water mark

Last Reply on Apr 30, 2015 09:05 PM By Mudassar

Posted on Apr 30, 2015 09:03 PM


I use below code to putting water mark for textbox

    <script type="text/javascript">
        var defaultText = "Enter Your Text here";
        function WaterMark(txt, evt) {
            if (txt.value.length == 0 && evt.type == "blur") {
                txt.style.color = "#b9b9b9";
                txt.value = defaultText;
            if (txt.value == defaultText && evt.type == "focus") {
                txt.style.color = "black";
                txt.value = "";

but when I click on button to insert data into database if I don't type any text in textbox it insert in database defult text :

"Enter Your Text here";

but I want if I don't type anything in textbox it doesn't insert any thing into database

Best Regards



This question does not have replies that have been liked.