I am using the corner plugin in order to get rounded div‘s. How can I use .delegate or .on to apply the plugin to div‘s that will be created in future?
This is what I have to get the rounded corners:
$('.myDiv').corner("10px");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would not use
.onordelegatefor this.You simply use your same line of code, but you would put it inside whatever function you use to create your new
divs..on()is used for binding “events” to dynamically created elements and would not work in your situation. However, for example, if you wanted to bind aclickevent to that newdiv, you’d useon()..delegate()has been superseded by.on()as of jQuery 1.7.