1

I am using JSignature to capture the signature of clients in our web application. There is a requirement that asks for providing a watermark on every signature texbox:some thing like "Please Sign Here" and while signing it should be removed.

Is it possible to have watermark in JSignature TextBox?

Thanks in advance.

user2948533
  • 1,143
  • 3
  • 13
  • 32

1 Answers1

1

$(document).ready(function() {
  var $sigdiv = $("#signature").jSignature({'UndoButton':true});
 
 $("#signature").bind('change', function(e){
  if ( $sigdiv.jSignature('getData', 'native').length > 0 )
   $("#signature span.label").addClass('hidden');
  else
   $("#signature span.label").removeClass('hidden');
 });
  
 $('.reset').bind('click', function () {
  $sigdiv.jSignature("reset");
  $("#signature span.label").removeClass('hidden');
 });
  
});
#signature * {
 zoom: 1;
 position: relative;
 z-index: 2;
}
#signature span.label {
 color: #bbb;
 display: block;
 font-size: 20px;
 padding: 20px;
 position: absolute;
 z-index: 1;
}
.hidden {
  display: none;
}
  <div id="signature">
   <span class="label">Your signature &hellip;</span>
  </div>
<button class="reset">Reset</button>

Off course, you can use (background)image(s) as well within the span.label. Use z-index, to position the canvas over the span.label.

gruneey85
  • 166
  • 2
  • 4