Install ReactJs on Codeanywhere

The way I did:

  • Log in to
  • Create a blank container by clicking File > New Connection > Container
  • Choose “Blank Development Stack” Ubuntu OS
  • It will open two tabs
  • Copy Container related information somewhere.  This information will have web address. This is the address you’ll need to view your application.
  • Go to terminal (this should be first opened tab)
sudo apt-get update
sudo apt install curl
curl -sL | sudo bash - 
sudo apt-get install nodejs
sudo apt-get install npm 
sudo npm install -g create-react-app 
create-react-app my-react-app 
cd my-react-app 
npm start

You’ll see http://localhost:3000 in your terminal. Ignore that. Use the web address you have copied before.

Happy coding!

jQuery: Using window url parameter

Let’s say we have passed a parameter to URL:

To collect the data form parameter we can use this function:

function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(;
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));

use of this code:



if (getUrlParameter('page') == 'test'){
// do something

jQuery item / image slider


Select random element using jQuery

Everytime you refresh, it will select random element & show it’s class

Removing CSS file link dynamically

Here style.css is already exist on the top of the file.
I am using just one line jQuery code to remove the CSS.


Javascript: change div or span content

document.getElementById("myAnchor").innerHTML = "Shohag Bhuiyan";
document.getElementById("myAnchor").href = "";
document.getElementById("myAnchor").target = "_blank";

Accessing variables from other functions without using global variables

var MyApp = {}; // Globally scoped object
function foo(){
MyApp.color = 'green';
function bar(){
alert(MyApp.color); // Alerts 'green'

JS: Hide Something