function pad(str, character, max, side, visibility) { str = str.toString(); console.log('inside pad: '+str); var pad; var output; pad=''; for (var i=str.length;i<max;i++ ) { pad = pad + character; } pad="<span style='visibility:"+ visibility + "'>" + pad + "</span>"; side=='left'? output=pad+str : output=str+pad ; return output; } input=$('#serialnumber').text(); $('#serialnumber').html( pad( input, 'F', 16, 'right', 'hidden') );
No comments:
Post a Comment