Quantcast
Channel: Adobe AEM CQ tips » javascript
Browsing latest articles
Browse All 6 View Live

Add file input dynamically to form using jQuery

Problem You have basic form with file input field and you want to add new fields dynamically. <form id="upload" action="upload.php" method="POST" enctype="multipart/form-data"> <label...

View Article


Fancybox doesn’t show div

Problem Showing div using fancybox doesn’t show nothing. Fancybox code $("#myDiv").fancybox(); Solution You can do a simple workaround. $.fancybox({ content: $("#myDiv").html() }); This will show...

View Article


Read hash from URL as key-value pairs using javascript

Problem How to get key-value pairs from hash(location.hash) part of URL via javascript? Solution function parseHashArgs(aURL) { aURL = aURL || window.location.href; var vars = {}; var hashes =...

View Article

How to add parameters to URL with javascript

Problem How to add parameters to URL that may already contain some parameters and/or anchor using javascript? Solution I’ve found solution on stackoverflow. Here is the code function addParameter(url,...

View Article

jQuery – use for loop to bind events

Problem Binding events in for loop with jQuery is not working. Here is example of not working code. for(var i = 0; i < 5; i++){ $("#selector"+i).click(function(){ $("#selector"+i).hide(); }); }...

View Article


AlloyUI modal – set headerContent dynamically

Problem How to set the AlloyUI Modal headerContent attribute dynamically? Solution The solution is simple. You call the .set("headerContent", "My header content") method on the modal object. Example of...

View Article
Browsing latest articles
Browse All 6 View Live