On Wednesday, 30 May 2012 16:56:16 UTC+2, R. Osinga wrote:
>
> The click event you receive contains a target-menber. 
>
This is the actual object that is clicked. You can use jQuery to find the 
> row  with the following statement:
>
> var TR = $(evt.target).closest('TR');
>

The row (and TD) contains three links of which only one has to be used for 
this purpose.  That is why I have marked the spesific link with an 
id-attribute. 

>
> if you add an attribute to the tr, say 'myattr' with the value 'myval'
>

That was already done and the link has an id which was used by the 
following code (which you helped me with) to add the necessary Bootstrap 
attributes:

    $('#merkmy').attr({
        'data-toggle': 'modal',
        'data-target': '#alt'
    });


the you would read it with the statement:
>
> $('a').click(function(evt{
>     var the_value = $(evt.target).closest('TR').attr('myattr');
>     // now you can do onything with this value that was declared in the 
> dom of the tr.
> }));
>  
>
Isn't that what this code is doing?

 $("a[data-toggle=modal]").click(function(event) {
        event.preventDefault();
        target = $(this).attr('data-target');
        url = $(this).attr('href');
        $(target).load(url);
        return false;
    });

 
 

> I hope, this answers your question
>
>
But I really appreciate your time and help.  I did make some progress.   
After your mail I added the (event)  to the code above and now I get a 
modal window with the data.  Thanks again.

Regards
Johann

Reply via email to