Find & replace jquery

后端 未结 3 1874
感动是毒
感动是毒 2020-12-17 02:01

I have this code to give me a rollover on submit buttons, and I\'m trying to make it more generic:

$(\'.rollover\').hover(
            function(){ // Change          


        
3条回答
  •  隐瞒了意图╮
    2020-12-17 02:34

    To manipulate the file name and append "-over" you simply have to do some Javascript string manipulation, like this:

    function appendOver(srcPath){
        var index = s.indexOf('.');
    
        var before = s.substr(0, index);
        var after = s.substr(index);
    
        return before + "-over" + after;
    }
    

    This should return the original filename (in all possible formats) and add the '-over' string just before the extension dot.

提交回复
热议问题