I can't follow the logic. Why toggle class?
Why check for class SeeMore2 since you already applied that? It should always be true
Why not just on click, change the text?
Is there some code that is not showing up in the forum?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi!
I am trying to get the text in a button to change text when a user clicks on it, to indicate that the click has been registered. I am using this code to get signatures on an iPad. If a customer presses the button with no signature, it gives an error to the user, and this code executes. But when a user has signed the form and presses submit, the code is not executed. Why is this?
Here is the code:
<div class="panel-body">
<center>
<p><strong>I confirm conditions.</strong></p></br>
{!! Form::open(array('action' => 'SignatureController@store', 'class' => 'sigPad', 'files' => 'true')) !!}
<ul class="sigNav">
<li class="clearButton"><a href="#clear">Clear signature</a></li>
</ul>
<div class="sig sigWrapper">
<!-- <div class="typed"></div> -->
<canvas class="pad" width="795" height="245"></canvas>
<input type="hidden" name="output" class="output">
</div>
<button type="submit" class="btn btn-primary btn-lg SeeMore2 m-b-5 m-t-10">Confirm</button>
{!! Form::close() !!}
</center>
</div>
The JS:
<script>
$(document).ready(function() {
var options = {
bgColour : '#fff'
, drawOnly : true
, lineTop : 200
, errorMessageDraw : 'Please sign.'
};
$('.sigPad').signaturePad(options);
});
</script>
<script>
$('.SeeMore2').click(function(){
var $this = $(this);
$this.toggleClass('SeeMore');
if($this.hasClass('.SeeMore2')){
$this.text('Confirm');
} else {
$this.text('Please wait...');
}
});
</script>
So, it works when the user has not signed, and the page is not sending a request, but when the user has signed and the request is being sent, the text does not change.
Please or to participate in this conversation.