Revision history [back]

click to hide/show revision 1
initial version

answered 2018-12-07 20:43:55 +0800

PopCorn gravatar image PopCorn

I'm using the 5.0.8 version of ZK.

GetInputNode () did not work here. I would like to know if there is any way to update ZK without having to change the lines of code of my project, considering that when updating the version of ZK in the project, it gave several errors in the java code.

If the update is not possible, I'd like to know some solution. Here is the JavaScript used to make the watermark:

(function($) { var map=new Array(); $.Watermark = { ShowAll:function(){ for (var i=0;i<map.length;i++){ if(map[i].obj.val()="=""){" map[i].obj.val(map[i].text);="" <br=""> map[i].obj.css("color",map[i].WatermarkColor); }else{ map[i].obj.css("color",map[i].DefaultColor); } } }, HideAll:function(){ for (var i=0;i<map.length;i++){ if(map[i].obj.val()="=map[i].text)" map[i].obj.val("");="" <br=""> } } }

$.fn.Watermark = function(text,color) {
    if(!color)
        color="#aaa";
    return this.each(
        function(){     
            var input=$(this);
            var defaultColor=input.css("color");
            map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
            function clearMessage(){
                if(input.val()==text)
                    input.val("");
                input.css("color",defaultColor);
            }

            function insertMessage(){
                if(input.val().length==0 || input.val()==text){
                    input.val(text);
                    input.css("color",color);   
                }else
                    input.css("color",defaultColor);                
            }

            input.focus(clearMessage);
            input.blur(insertMessage);                              
            input.change(insertMessage);

            insertMessage();
        }
    );
};

})(jQuery);

I'm using the 5.0.8 version of ZK.

GetInputNode () did not work here. I would like to know if there is any way to update ZK without having to change the lines of code of my project, considering that when updating the version of ZK in the project, it gave several errors in the java code.

If the update is not possible, I'd like to know some solution. Here is the JavaScript used to make the watermark:

(function($) {
    var map=new Array();
    $.Watermark = {
        ShowAll:function(){
            for (var i=0;i<map.length;i++){ if(map[i].obj.val()="=""){" map[i].obj.val(map[i].text);="" <br="">
i=0;i<map.length;i++){
                if(map[i].obj.val()==""){
                    map[i].obj.val(map[i].text);                    
                    map[i].obj.css("color",map[i].WatermarkColor);
                }else{
                    map[i].obj.css("color",map[i].DefaultColor);
                }
            }
        },
        HideAll:function(){
            for (var i=0;i<map.length;i++){ if(map[i].obj.val()="=map[i].text)" map[i].obj.val("");="" <br="">
i=0;i<map.length;i++){
                if(map[i].obj.val()==map[i].text)
                    map[i].obj.val("");                 
            }
        }
    }

}

    $.fn.Watermark = function(text,color) {
     if(!color)
         color="#aaa";
     return this.each(
         function(){     
             var input=$(this);
             var defaultColor=input.css("color");
             map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
             function clearMessage(){
                 if(input.val()==text)
                     input.val("");
                 input.css("color",defaultColor);
             }

             function insertMessage(){
                 if(input.val().length==0 || input.val()==text){
                     input.val(text);
                     input.css("color",color);   
                 }else
                     input.css("color",defaultColor);                
             }

             input.focus(clearMessage);
             input.blur(insertMessage);                              
             input.change(insertMessage);

             insertMessage();
         }
     );
 };
})(jQuery);

})(jQuery);

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More