$('[id^="save_"]').click(function () {});
How is the element being selected using id here?
$('[id^="save_"]').click(function () {});
How is the element being selected using id here?
As quoted from the jQuery website:
Selects elements that have the specified attribute with a value beginning exactly with a given string.
https://api.jquery.com/attribute-starts-with-selector/
So if you have in your DOM two elements which are #save_address
and #save_cart
to select both of them by the same prefix save_
you will use $("[id^='save_']")