Now I am trying to change the button text of the form to a heart icon. When a post is not favorited by the user yet it should be white and if it is it should be red. In the above mentioned support thread this JQuery code is giving for manipulating the button text:
This code works. However, when I try adding html tags to the strings they don't render. Here's an example of what the button could contain instead of just text.
Before favorite:
<span class="dashicons dashicons-heart" style="color: white; font-size: 30px;"></span>
After favorite:
<span class="dashicons dashicons-heart" style="color: red; font-size: 30px;"></span>
Hello. Thank you for contacting the Toolset support.
The thing is that value attribute do not support the non-text value that is why is not get rendered.
You need to change your submit button to button within your form. So, you need to edit your form and remove the submit button shortcode and you need to replace the submit button shortcode with the following button code. Something like as follows:
Thanks, the code works. I see the heart changing from white to red. However, how do I get the new button element linked to the form? If I submit the form using it the form doesn't work (favoriting or unfavoriting a post). It only works when using the old button.
The thing is that what you applied is custom code and you need to find a way to submit the form.
I am not sure why its not working. Can you please share the problem URL where you added the form as well as access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Sorry, just one more small thing. When I use Ajax to refresh the form the code doesn't run so the initial value of the button 'Submit' appears. Is there another event we can 'bind' this code on so it would work with Ajax as well? Just dipping my toe into the wondrous world of JQuery so yeah...
Also, the way this code is set up the value of the button doesn't change until the entire page is loaded which looks a little silly i.m.o.
The help you are asking is above and beyond the scope of our support policy. I am afraid that I would not be able to help you further and I hope this is totally understandable.
Initially, I already help you with your custom code but this is pure JS custom code and I suggest you should hire a pro JS developer to help you out on this issue as this is not originally Toolset issue as this is pure customizations you want to implement as per your requirement.
You can always contact our certified patterns for your any custom programming requirement using the following link:
=> https://toolset.com/contractors/