Reputation: 31
this code generated in php id="sus- ... <--- is static and id="sus-d->id ?>" is my problem to select that
<button class="btn btn-danger btn-xs" id="sus-<?= $D->d->id ?>" ><i class="icon-trash "></i></button>
out put :
id="sus-2131"
so i want select all id's start with
sus-
with below function :
jQuery('#sus-').btsConfirmButton({msg:"I'm sure!"}, function(e) {
d_manage('delete','<?= $D->d->id?>');$(this).slideUp();
});
that it !
Upvotes: 0
Views: 254
Reputation: 1814
Use the attribute selector:
$('[id^=sus]').btsConfirmButton({msg:"I'm sure!"}, function(e) {
d_manage('delete','<?= $D->d->id?>');$(this).slideUp();
});
Upvotes: 0
Reputation: 30567
Use the starts with selector ^= like
jQuery('[id^="sus-"]').btsConfirmButton({msg:"I'm sure!"}, function(e) {
d_manage('delete','<?= $D->d->id?>');$(this).slideUp();
});
Upvotes: 1
Reputation: 3033
If you made each item use the css class "sus" instead you might be able to select them all with something list $('.suss').each()...
You would then be able to iterate over each "sus" item.
Hope this helps.
Upvotes: 0