Really Simple CAPTCHA In AJAX Page

Ajaxify WordPress Site Pro is a plugin which helps you to reload the Google recaptcha form in ajax loaded page. This plugin already a wel known plugin in WordPress community to make your whole WordPress site ajaxify. Let us have a quick look into what are the features available in this plugin
Continue reading “Really Simple CAPTCHA In AJAX Page”

How to make placeholder work in IE browser

As we all know that HTML 5 placeholder attribute is not working in IE less than 10 version. If you have input elements in your DOM with placeholder attribute and access the page in IE browser less than 10 version then you will get an error message that placeholder is not defined. To resolve this issue you have to use javascript or jQuery. I have attached a sample code file please download and check it out in different browser. Sample Code

jQuery Tips & Tricks for jQuery Programmers

1. Set Context and improve the performance
On the core jQuery function, specify the context parameter when. Specifying the context parameter allows jQuery to start from a deeper branch in the DOM, rather than from the DOM root. Given a large enough DOM, specifying the context parameter should translate to performance gains.
$("input:radio", document.forms[0]);

2. Live Event Handlers
Set an event handler for any element that matches a selector, even if it gets added to the DOM after the initial page load:
$('button.someClass').live('click', someFunction);
This allows you to load content via ajax, or add them via javascript and have the event handlers get set up properly for those elements automatically.

3. Checking if an element exists
Use following snippet to check whether an element exists or not.
if ($("#someDiv").length) {
//Enjoy!!! it exists...

4. Line breaks and chainability
Instead of doing:
You can increase readability like so:

5. Alternate way of Document Ready
//Instead of
$(document).ready(function() {
//document ready
//document ready

6.Selecting immediate child of an elements
If you want to count all the DIVs present in the element #outer

<div id=”outer”>
<div id=”immediat1″></div>
<div id=”immediat2″>
<div id=”inner”>

//jQuery code to count child elements
$("#foo > div").size()

7. Getting Parent DIV using closest
If you want to find the wrapping DIV element (regardless of the ID on that DIV) then you’ll want this jQuery selector:

8. Disable right-click contextual menu
There’s many Javascript snippets available to disable right-click contextual menu, but JQuery makes things a lot easier:
return false;

My js events are not calling after loading the page using AJAX

Whenever we are loading any data in DOM through AJAX, these data are not registered into the DOM that is why jQuery code written for any event like click, change, submit etc for any element, are not fired.
By defining those events in jQuery on or live function we can solve this problem. But if we are using any contribute js files then it is not possible for us to go through the code and define all the event in on or live functions.
So now the question is how we can solve this problem?
Solution is reload the corresponding js file again.

Solution for some particular cases using the AWS plug-in:

BuddyPress activity pages don’t load correctly

a) Open file ajaxify.js
b) Search for “$body.removeClass(‘loading’);”
c) Paste the below code just before this line
scriptNode = document.createElement(‘script’);
scriptNode.setAttribute(‘src’, rootUrl + ‘wp-content/plugins/rehabtabs/js/rehabtabs.packed.js?ver=3.3.2’);

Page breaking in case of using ‘rehabtabs’ wordpress plug-in

a) Open file ajaxify.js
b) Search for “$body.removeClass(‘loading’);”
c) Paste the below code just before this line
scriptNode = document.createElement('script');
scriptNode.setAttribute('src', rootUrl + 'wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js?ver=20120110');