How To Detect Button Value Change In Jquery?
I've a sign up form which has submit button with value 'GET INSTANT ACCESS!' : After submit
Solution 1:
$(function() {
$('.btn1').on('change', function() {
alert('Do stuff...');
});
$('.lnk1').on('click', function() {
$('.btn1').val('Thank you!');
$('.btn1').trigger('change');
});
});
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><inputtype="submit"class="btn1"value="SUBSCRIBE" /><ahref="#"class="lnk1">Change button value</a>
Solution 2:
OK , when button is clicked and form is submitted for saving. just write these code
$(document).ready(function ()
{
$('.wf-button').click(function ()
{
var valueofbutton = $(this).attr('value');
if(valueofbutton == 'Thank You!')
{
window.open(); //// whatever you want to open in popup
}
});
});
i m sure that this will work
Solution 3:
You can use the following function in javascript which gets called after any > kind of postback, i.e. synchronous or asynchronous.
function pageLoad() { if($(".wf-button").val()=="Thank You!") { // show your popup } }
Hope it works....
Post a Comment for "How To Detect Button Value Change In Jquery?"