Categories
jQuery

jQuery search and highlight text

Using jQuery you can search and highlight text within a div from array of elements and wrap a highlight span around each word. Example to search and highlight text: <script type=”text/javascript”> var regex = /(Rubbish|Like|Rough|Raw|Doggie|Billy)/ig; $(‘#divID’).each(function() { var $this = $(this); var text = $this.text(); if (regex.test(text)) { $this.html( $this.html().replace(regex, ‘<span>$1</span>’) ); } }); </script>

Categories
jQuery

Avoid jQuery conflicts with other libraries

jQuery uses $ as a alias or shortcut. So if you use another javascript library (like prototype, mootools etc) that uses same alias then you are in a jQuery conflicts situation. Use no-conflict mode to avoid jQuery conflicts: You have to use a new variable name to replace with jQuery $.For e.g. <script src=”jquery.js”></script> <script […]

Categories
MySQL

Understanding MySQL LEFT JOIN

MySQL LEFT JOIN allows you to get result set from two or more tables for certain matches. Suppose you have two tables i.e. A and B. So if you join A to B using left join then all rows from the A tables will be displayed with matches a row from the B table. Example […]

Categories
Html

HTML Document Structure

Here you will see how the basic html document structure looks like. The page includes a doctype declaration with a html, head, title and body element. Doctype tells the browser what version oh html is using in the document.For latest version html5 it is written as <!DOCTYPE html> Read Also: HTML Forms The other elements […]

Categories
Css3

A Little Known CSS Facts

As you have been writing css for several years day by day you are getting new things that you have never used previously. Each and every well trained front-end developer feature-tests before using any features which a browser may not have. This feature testing has always done with scripting, and most of the people use […]

Categories
jQuery

Steps to take when jQuery is not working

Sometimes it may happen that you used jQuery but it not working and you are in a deep trouble that makes you puzzle at a moment. So what to do with the jquery steps? Here are few simple things that are primary jquery steps to check for sure. JavaScript disabled/not supported by browser: Make sure […]

Categories
KnockoutJS

KnockoutJS – Templating

Using template is very easy to incorporate into website. For a duplication you don’t need to write over and over again just call them repetitively. Parameters:Following properties can be sent as a parameter-value:name, nodes, data, if, foreach, as, afterAdd, afterRender, beforeRemove. Lets see an example of Templating: <!DOCTYPE html> <head> <title>KnockoutJS – Templating</title> <script src=”http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.3.0.js” […]

Categories
KnockoutJS

Dependency Tracking – KnockoutJS

Using a single object called dependency tracker i.e. ko.dependencyDetection you can determine when the value get updated. When you declare a computed observable, KO immediately gets its initial value and updated computed observable. Lets see an example for Dependency Tracking: <!DOCTYPE html> <html> <head> <title>Dependency Tracking – KnockoutJS</title> <script src=”http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.1.0.js” type=”text/javascript”></script> </head> <body> <div> <form […]

Categories
Html5

HTML5 – Tips & Tricks

HTML5 has a lot of new tools to build website for better user experience and it is strong and powerful version of HTML. For Mobile phone applications it is used to a very great extent. Here are some tips and tricks for HTML5 HTML <!DOCTYPE> Declaration:The <!DOCTYPE> declaration is the first tag in your HTML […]

Categories
KnockoutJS

KnockoutJS – Declarative Bindings

To connect data to UI declarative bindings are used. As bindings and Observables both are different, using normal javascript object you can bind view. Declarative Bindings consists of two values i.e. name and value: Full name: <input data-bind=”value: fullName, valueUpdate: ‘afterkeydown’” /> Here when each key is pressed value will be updated.