You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a project that I recently started, there were instances where I had to transfer data from a button triggering a modal window to a hidden input in the form inside the modal. I wonder if it would be a good idea to integrate this directly into Bootstrap. Here's the code I wrote to accomplish that:
$(".dataClickTransfer").click(function () { let data = $(this).attr("dataToTransfer"); let id = $(this).attr("dataTargetId"); $(id).val(data); });
and also here is an example of html code to exploit it:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In a project that I recently started, there were instances where I had to transfer data from a button triggering a modal window to a hidden input in the form inside the modal. I wonder if it would be a good idea to integrate this directly into Bootstrap. Here's the code I wrote to accomplish that:
$(".dataClickTransfer").click(function () { let data = $(this).attr("dataToTransfer"); let id = $(this).attr("dataTargetId"); $(id).val(data); });
and also here is an example of html code to exploit it:
<button dataToTransfer="<?= $y['id'] ?>" dataTargetId="#yearId"> </button>
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions