
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
jquery-jcreate
Advanced tools
jCreate is a new special event for jQuery. Just use .on('create', ..); the callback will be triggered when elements are created on the page.
jCreate is a plugin for jQuery that adds a new bindable event. Did you ever look for something like $(document).on("create", function() { ... });?
Now you can do something cool when one or more elements are created and are available on the page.
See it in action with CodePen.
You can install jCreate using Yarn or npm:
# yarn
yarn add jquery-jcreate
# npm
npm install --save jquery-jcreate
import $ from 'jquery';
import 'jquery-jcreate';
$(document).on('create', '*', function(event) {
console.log( 'created tag: ', event.$currentTarget.prop('tagName') );
});
define(["jquery", "jquery-jcreate"], function( $ ) {
$(document).on('create', '*', function(event) {
console.log( 'created tag: ', event.$currentTarget.prop('tagName') );
});
});
You can install jCreate using Bower:
bower install --save jquery-jcreate
And now you can include it in you project with a <script> tag.
<script type="text/javascript" src="jquery.jcreate.min.js"></script>
<script> tag using CDNsjsDelivr is a global CDN delivery for JavaScript libraries.
To include the latest releases and all upcoming features and patches, use this:
<script src="https://cdn.jsdelivr.net/npm/jquery-jcreate@1/dist/jquery.jcreate.min.js"></script>
jCreate works with the jQuery Event Delegation.
// bind 'create' event.
$( '#dataTable tbody' ).on( 'create', 'tr', function( event ) {
console.log( event.$currentTarget.text() );
});
// add a new 'row'.
$( '#dataTable tbody' ).append('<tr><td>this is a new row!</td></tr>');
$( document ).on('create', 'a', function( event ) {
console.log( event.type ); //= "create"
});
timeStamp - The difference in milliseconds between the time the browser created the event and January 1, 1970.
currentTarget - The current DOM element within the event bubbling phase.
$( document ).on('create', 'a', function( event ) {
console.log( event.currentTarget === this ); //= true
});
$( document ).on('create', 'a', function( event ) {
console.log( event.$currentTarget.is( $(this) ) ); //= true
});
$( document ).on('create', 'a', function( event ) {
console.log( event.delegateTarget === document ); //= true
});
$( document ).on('create', 'a', function( event ) {
console.log( event.$delegateTarget.is( $(document) ) ); //= true
});
<div data-component-name="hello-world"></div>
$( document ).on('create', 'div', function( event ) {
console.log( event.options('component') ); //= {name:"hello-world"}
});
jquery >= 1.8
Since I use the last version of jasmine-jquery library in order to test my own plugin, I cannot ensure that the plugin works with jQuery 1.7 and below, due to the fact that jasmine-jquery uses methods that were introduced in jQuery 1.8.
Modules are an integral piece of any robust application's architecture and typically help in keeping the units of code for a project both cleanly separated and organized.
var myModule = (function () {
var module = {}
, _privateVariable = 'Hello World'
;
var _privateMethod = function() {
return _privateVariable;
};
module.publicProperty = 'Foobar';
module.publicMethod = function () {
console.log( _privateMethod() );
};
return module;
}());
Here follows a simple example on how to use the Module pattern with jCreate.
<div data-component="hello-world" data-hello-world-name="Marco"></div>
var helloWorldComponent = (function () {
var module = {}
, _componentName = 'hello-world'
;
module.greeting = function( name ) {
console.log( 'Hello ' + name + '!' );
};
$(document).on('create', '[data-component~="' + _componentName + '"]', function( event ) {
var options = event.options( _componentName ); //= {name:"Marco"}
module.greeting( options.name ); //= Hello Marco!
});
return module;
}());
helloWorldComponent.greeting('Marco'); //= Hello Marco!
To install Grunt and Bower, you must first download and install node.js - which includes npm.
Then, using the command line:
# install `grunt-cli` globally
npm install -g grunt-cli
# install `bower` globally
npm install -g bower
# navigate to the root of your project, then run
npm install
bower install
FAQs
jCreate is a new special event for jQuery. Just use .on('create', ..); the callback will be triggered when elements are created on the page.
The npm package jquery-jcreate receives a total of 353 weekly downloads. As such, jquery-jcreate popularity was classified as not popular.
We found that jquery-jcreate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.