Having trouble with my JavaScript working
-
Hi,
Downloaded the plugin and am enjoying it. However, I am having trouble using it to create some functionality that I want to achieve using WooCommerce and the WooCommerce Product Bundles plugin, specifically.
In essence, I have some JavaScript that works when used outside the plugin, but when I move it into the plugin, it no longer works. Now it’s likely that this is an error on my side, but regardless, I can’t seem to get it to work. Any help would be appreciated.
Here is the code:
‘
<script type=”text/javascript”>
jQuery( document ).ready(function() {
jQuery(‘#smartphone-type’).on(‘change’, function() {
console.log(“asdf”);
if (jQuery(‘#smartphone-type’).val() == ‘iPhone’) {
jQuery(‘.has_qty_input .bundled_qty’).val(‘1’);
} else {
jQuery(‘.has_qty_input .bundled_qty’).val(0);
}
});
});
</script>
‘My site is dab-test.com. The above JavaScript – when working – should update the quantity of one product (anything with the smartphone-type attribute) to 1 or 0 based on the selection of the type of smartphone made by the user.
Thanks for the help.
- The topic ‘Having trouble with my JavaScript working’ is closed to new replies.