jQuery : Select All Checkbox


Yahoo! Mail and GMail both has a checkbox on top of their email list which will “checked” all chekboxes when clicked. Previously I use plain old javascript like those in this link, I just try to use jQuery to do this, its only 5 lines

$('#selectAll').click(function(event){
    $('input[type="checkbox"]').each(function(){
        this.checked = event.target.checked;
    });
});

Casperjs – Couldn’t find nor compute phantom.casperPath, exiting


I just installed phantomjs v2.0 on a Windows box, add its location to its path, download casperjs v1.0.4, extract to root folder on C: drive, rename the folder to casperjs, add casperjs\batchbin to its path (not casperjs\bin as suggested in its documentation), invoking casperjs –version on the command line, but then getting this error message

Couldn’t find nor compute phantom.casperPath, exiting

googling for a minutes, I got the solution here https://github.com/n1k0/casperjs/issues/1150

just add these 4 lines code into casperjs\bin\bootstrap.js file


var system = require('system');
var argsdeprecated = system.args;
argsdeprecated.shift();
phantom.args = argsdeprecated;

CKEditor – Get Content


<textarea id=”content_id”></textarea>

<input type=”button” value=”Clickme” onclick=”showData()” />

<script type=”text/javascript”>

function showData(){

var sourceText = CKEDITOR.instances[“content_id”].getData();

alert(sourceText);

}

</script>