- Use data-{your custom attribute name}
- <a data-url="<?php echo admin_url('admin-ajax.php'); ?>">
- Get data- value
- var url =$(this).data('url');
- Edit data- attribute value
- newUrl = 'https://excellentprogrammingtricks.blogspot.com/';
- $(this).data('url', newUrl );
- Inspect option shows old value because it's not dynamically updated.
- So, finally can use multiple data- attribute with different name in tag.
No comments:
Post a Comment