Tuesday, 18 October 2016

Really don't have much to say,
https://github.com/sdkcodes/codeigniter_bootstrap_alert
Head over to the link, it says it all.
Thanks

I just published a tiny helper library

Wednesday, 12 October 2016

So, you've just started your programming journey and it has been a pretty mixed feeling - sometimes feeling extremely excited when your code runs, and the other times , extremely frustrated when you have no idea what's wrong . Well, either ways, I'm happy to welcome you to the brotherhood.
In this post, I'll be talking about a concept in programming (and consequently in JavaScript) which is very important and this is the concept of variables.
Variables are very important and essential in programming and all programming languages, and I should I have talked about it alongside another related important concept (Data Types), but I'll do that in a separate post.
What are Variables?
A variable is a name in memory that stores a value.
Let me take you back to your basic mathematics algebra class:
Let x = (22/5 + 2)
Assuming (22/5 + 2) is a long expression, we have just saved this expression in a variable x, such that, anytime we use x in our subsequent calculations, we are actually referring to (22/5 + 2). You dig?
Now, coming back to JavaScript, this is how variables are used:
i = 1000;
In the case above, i is the variable name and 1000 is the value stored in the variable.
From the above example, whenever we use the name i in other parts of the same program, the value 1000 will be substituted.
I want to think it's making sense now.
In JavaScript, it is advisable to declare a variable first before using it, and you do this by using the var keyword. As in:
      var name;
      name = "Elusoji Sodeeq"
In the first line of code above, what we did is called "variable declaration". We are telling the JavaScript interpreter, :"hey, I want to register this variable name with you".
On line 2, what we did is called "variable assignment". We assigned value "Elusoji Sodeeq" to the variable we declared earlier. This is like saying, : "hey, JavaScript interpreter, remember the variable I registered with you earlier. Good. I want to give it a value now".
Now, that's it, we have just created and used a variable in JavaScript.
Variables can be used to store values of any type. I'll talk about Data Types in another post.
You can read further here
That will be all from me, for now.

Javascript variables :- a quick introduction

Sunday, 10 July 2016

Woh!! So, like I said on my twitter timeline earlier, I'll be posting a number of tutorial, tips for aspiring, beginning and maybe even intermediate programmers on this blog. And for starters, I'll make this first post a super simple one.
I'll show you how to get the value typed in an html textbox using javascript.
Now, if you are very good with javascript or you're are already an experienced programmer, you can look the other way as this tutorial is not meant for you.

I'm going to use the sample html code below:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
 <title>Trying Javascript</title>
</head>
<body>
 <form>
  <input type="text" name="username" id="username" placeholder="Input your Username">
  <br>
  <input type="text" name="email" id="email" placeholder="email@example.com">
  <button type="button" onclick="showDetails()">Show Details</button>
 </form>
</body>
<script>
 function showDetails(){
  var username = document.getElementById('username');
  var email = document.getElementById('email');
  alert('Your username is: ' + username.value + '\n\
   And Your email is: ' + email.value);
 }
</script>
</html>
I'll go through what's happening in the code above now
From line 1-13, I did the normal html stuff, but two things you need to pay attention to here are the id attributes of input element and the onclick attribute of the button element.
Assigning an id to any html element makes it possible for our javascript code to find that element and use it comfortably.
The onclick attibute makes sure that out the button responds when it is clicked on. When the button is clicked, the showDetails() function will be executed.

From line 15 - 20, we defined our showDetails() function, and inside the function, we firstly retrieve the two input elements using their respective IDs. (remember the id we set earlier in out html).
Now, we can do anything with the values of those elements, in this example, i chose to pop up an alert when the button is clicked. The values can be used for just about anything you want, e.g for validation, for sending to a server script using ajax, or just saving in cookie.

Now, that's all from me for now. If anything seem unclear, do not hesitate to let me know
Take care!!

How to get Form Input value using Javascript

Thursday, 28 May 2015

Hello everyone like you all can see, this is a new born baby  blog. On here, I will be talking about pretty much anything. That is, from myself, to tech, to writing, to my life and a whole lot of other interesting things you might enjoy.

This is going to be a good ride, I hope...

Welcome to my home