Learn how to change page title using jQuery
Following jquery code is used to change the page title. $(document).attr(‘title’, ‘new title’);
Continue Reading →By admin|Computer, JavaScript, jQuery
Following jquery code is used to change the page title. $(document).attr(‘title’, ‘new title’);
Continue Reading →Think, you want to get timestamp for today midnight, then use following code. $timestamp = strtotime(‘today midnight’); Also, you can refer php date time here. http://php.net/datetime
Continue Reading →By admin|Computer, JavaScript
Think if you want to pass parameters to setTimeout function of javascript. Then, there are 2 common ways to do it. Following one is the most preferred way. Here, yourfunction() is the function which you want to call and the para1, para2, paraN are the parameters which you want to call. setTimeout(function(){ yourfunction(para1, para2, paraN); […]
Continue Reading →You can use following code to merge two lists in python. listone = [1,2,3] listtwo = [4,5,6] newlist =[] for elem in listone: newlist.append(elem) for elem in listtwo: newlist.append(elem) Another way to do it. listone = [1,2,3] listtwo = [4,5,6] newlist = listone + listtwo And another way to do it. newlist = [] newlist.extend(listone) […]
Continue Reading →You have to include ‘from random import choice’ line. mylist = [‘z’, ‘y’, ‘x’, ‘v’, ‘u’] from random import choice print choice(mylist)
Continue Reading →If you want to remove underline from hyperlink, you can use the text-decoration property for the link to specify if you need an underline or not. If you set the text-decoration property to none, you can remove underlines from hyperlinks in our html page. a:link, a:visited { text-decoration: none; }
Continue Reading →By admin|Computer, JavaScript, jQuery
Think you want to get checkboxes value which are checked using jquery. You can use following code to do that. $(‘input:checkbox:checked’).each(function(index){ alert($(this).val()); }); or else you want to get the array of the checked checkbox value. Then use following code. var data = $(‘input:checkbox:checked’).map(function(){ return this.value; }).get(); //this will give array like this. [’19’, ’20’]
Continue Reading →By admin|Computer, JavaScript, jQuery
There are few ways to reload the page using javascript. window.location.reload(); history.go(0); window.location.href=window.location.href; // will do nothing if your URL has a #/hashbang on the end learnhow2do.com/test#blah window.location = window.location.pathname; //Some of the browsers like Firefox opens ConfirmBox for resend.If you reload after post request.
Continue Reading →Let’s say you have an associative array like: {“key1”: 22, “key2”: 42} Then if you need to check key1 exists using python, following code will do that. if key in array: # do something Note: Be sure to put the key name in quotes if it’s a string. Associative arrays are called dictionaries in Python […]
Continue Reading →By admin|Computer, Internet, MySQL, PHP
Codeigniter Active Record syntax for join $this->db->join(); Ex: $this->db->select(‘*’); $this->db->from(‘user’); $this->db->join(‘review’, ‘review.id = user.id’); $query = $this->db->get(); And it will generate following sql. SELECT * FROM user JOIN review ON review.id = user.id if you need several joins in one query, you have to call join function multiple times. If you need a specific type […]
Continue Reading →