Created
June 10, 2012 23:12
-
-
Save brentsowers1/2907648 to your computer and use it in GitHub Desktop.
jQuery attachment types test cases 3 and 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateUniqueClasses(attachEventDirectly, elementsToGenerate) { | |
var generateFunction = function() { | |
var containerElement = $("#container"); | |
containerElement.html(""); | |
for (var i=0; i < elementsToGenerate; i++) { | |
var element = $('<div id="element' + i + '" class="differentClassItem' + i + '"><a href="#">click me</a> </div>'); | |
containerElement.append(element); | |
if (attachEventDirectly) { | |
element.click(callbackFunction); | |
} else { | |
containerElement.on('click', ".differentClassItem" + i, callbackFunction); | |
} | |
} | |
}; | |
timeAction(this, generateFunction); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment