Many sites provide JSONP services, allowing you access to their content via a predefined API. Great source of JSONP-formatted data is the Yahoo Query Language. Below example, we’ll use YQL JSONP API service to populate the top news from yahoo rss and display on the web page. You can use the above code to populate
This post has jQuery code to show the time in different time zones using jclock plugin. You can use this code to display world clock. Here, I am displaying country names in dropdown, when you click on that it will show the current time in that country. See the live demo here. We have used
Here is the javascript code to increase or decrease the font size on the fly, you can give control to the user to change the text size for better readability. function resizeFont(multiply) { var sz = document.body.style.fontSize; if (sz =='') sz = 14; //default font size var size = parseFloat(sz) + (multiply * 0.2) +
In this tutorial, I am going to give a JavaScript code samples to create, read and delete the cookies. Setting a Cookie function SetCookie(name,value,days) { var now= new Date(); var expDate = new Date(); if (days==null || days==0) days=1; //create date after no of "days" from now expDate.setTime(now.getTime() + 3600000*24*days); //create cookie with name, value
jQuery template plugin allows you to render template items into HTML DOM, template items are HTML markup or text. Basically, we can define HTML markup with template variables and replace these variables inside the DOM when you get the data from an Ajax call or local static data. Here is the simple example to display
Here I am going to show how to highlight particular word within a block of text.You can use this feature to:– highlight the search terms on the page.– highlight particular keywords dynamically on the page.– highlight negative numeric values on block of page. Below is the working example, enter the text in textbox and click
In most of the websites, you might notice textboxes with gray text inside which explains what is it for, and when you focus on the textbox it disappears and reappears when you leave the empty textbox. To achieve this, what i do is:– get the hint text from title attribute of textbox.– Show hint text