Last active
October 1, 2019 04:31
-
-
Save mehedicsit/39ca0a6ae49f0ebd84bdb4d8c523d585 to your computer and use it in GitHub Desktop.
Get data attribute from radio button for on change event with jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).on('change', 'tag or class name', function() { | |
// Does some stuff and logs the event to the console | |
var packPrice=jQuery(this).attr("data-price"); | |
jQuery('span.totalprice').text("$"+packPrice); | |
}); | |
//onchnage with calculation | |
jQuery(document).on('change', 'input.pbu-package, input.field-element.numberlicenses', function() { | |
var packPrice=jQuery('input.pbu-package:checked ').attr("data-price"); | |
var licenseincrement=jQuery('input.field-element.numberlicenses').val(); | |
jQuery('span.totalprice').text("$"+packPrice * licenseincrement); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment