0

Guys is it possible to assign Double click event to A HREF which is dynamically generated , to which i need to assign a user function with parameter that will differ for each a HREF.kindly let me know.

3 Answers 3

1

you can use class instead of id and do what Matt said.

$('.Class').live('click',function(event)
{
  myFunc($(this));
});
Sign up to request clarification or add additional context in comments.

1 Comment

@Suresh, just class. add a 'class="something"' inside the a "father" tag. Then, on Jquery, you select the 'a' tags doing.. $(".class a"). It's a way to do that. Or just put a class on 'a' tag.
0
$('.generated').live('click',function(event)
{
  //determine params here

  myFunc(params);
});

For every 'a' tag that ends up on your page, when it is clicked, it will call myFunc with the jQuery version of itself as the paramater

1 Comment

each A href has an id , i do not want to assign the function for all link ,only to dynamically generated ones , and function parameters changes for each links.
0

Try this function. This is a simple JavaScript. Using this method we can assign a function dynamically on an html element.

var funcRef = new Function("testFunction()"); document.getElementById("elementid").onclick=funcRef;

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.