0

I have the following jTemplate:

{#foreach $T.d as post}
<li>
    <label for="ContactDetail">{$T.post.DetailType}</label>
    <input type="text" id="ContactDetail_{$T.post.ContactDetailId}" runat="server" class="w400" autocomplete="on" value='{$T.post.Detail}' />
    <div id="deletecontactdeet"><a href="#" id='{$T.post.ContactDetailId}' class='delete-deet'><img src="/images/iconography/tiny-delete.png" alt="Delete this entry" title="Delete this entry" border="0" /></a></div>
</li>
{#/for}

I am then following the call to this template attaching a .click to the a within the template:

var deetid;
            $('.delete-deet').click(function () {
                deetid = $(this).attr('id');
                alert(deetid);
                $('#delete-dialog').dialog('open');
                return false;
            });

The .click never fires however. I suspect it maybe because the DOM object is/has been created within the template - does anyone have any clues or suggestions as to how to solve this?

Help, as always, is appreciated.

1 Answer 1

1

Try .live():

$('.delete-deet').live('click', function () {
    deetid = $(this).attr('id');
    alert(deetid);
    $('#delete-dialog').dialog('open');
    return false;
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.