This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 4

Auto Deleting Field Default Custom Javascipt


  1. eventura
    Member

    Hi Guys

    Been asked for this a number of times and so wrote a custom javascript for the relevant form. You can replicate the code for each field and amend the field number / text appropriately. Hope it helps.

    $(document).ready(function(){

    //Set Name Field Default
    $('#element_1').val("Name");
    $('#element_1').css("color", "#ccc");
    $('#element_1').focus(function(){
    $(this).css("color", "black");
    if ($(this).val() == "Name") {
    $(this).val("");
    }
    });
    $('#element_1').blur(function(){
    $(this).css("color", "#ccc");
    if ($(this).val() == "") {
    $(this).val("Name");
    }
    });
    // End of Name Field

    });

    Posted 9 years ago #

RSS feed for this topic

Reply