Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Unable to get data-id value #36

Open
manusharma1 opened this issue Apr 29, 2016 · 2 comments
Open

Unable to get data-id value #36

manusharma1 opened this issue Apr 29, 2016 · 2 comments

Comments

@manusharma1
Copy link

manusharma1 commented Apr 29, 2016

Hi,

I am using bootstrap confirmation in Meteor.JS App

Here is my code:

HTML

There is a loop which fetch the data from DB

            {{#each FetchRecords}}
            <tr>
                <td><a href="#" data-id="1" class="edit">{{name}}</a></td>
                <td>{{order_id}}</td>
                <td><a class="btn confirmation" id="delete" data-toggle="confirmation" data-id="{{_id}}" data-placement="right" data-original-title="" title="">Delete</a></td>
            </tr>
            {{/each}}

JS:

      $('[data-toggle="confirmation"]').confirmation({onConfirm: function(){
    console.log($(this).data("id"));

      }});

I am unable to get the data-id value, its saying undefined. Could you please tell me how to fetch the data-id value when the confirm button is clicked.

Thanks and Best Regards,
Manu

@cerojas
Copy link

cerojas commented Aug 26, 2016

did you solved that? i have this problem too

@cerojas
Copy link

cerojas commented Aug 26, 2016

I get the value from href property

javascript

$('[data-toggle="element-confirm"]').confirmation({
        title:"Some question?"
        ,btnOkLabel:"YES"
        ,btnCancelLabel:"NO"
        ,onConfirm: function (obj) {
                        var valueOfHref = obj.currentTarget.href.split('/').pop()
            console.log(valueOfHref );
            $(".tracking .icon_td .popover").find('.popover-content').html("Cambiando...");
                        alert("waiting...");
            $('[data-toggle="solicitud-estado-confirm"]').confirmation('hide');

            return false;
        }
    });//confirmation

html

<a data-href="1" href="1"  data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 1</a>
      <a data-href="2" href="2"  data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 2</a>
      <a data-href="3" href="3"  data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 3</a>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants