textbox water mark

Last Reply one year ago By Mudassar

Posted one year ago


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



You are viewing reply posted by: Mudassar one year ago.
Posted one year ago

Add a checking before Insert

if(TextBox1.Text != ""Enter Your Text here"")



I agree, here is the link: http://e-iceblue.com/free-api