Archive for the ‘javascript’ Category

In many cases we do not want make two buttons to show or hide a same div area. for example expand and collspan method. jQuery provides a simple technique to check div id is already shown or hidden. Create a div are on which you want to do...

In php we have a function to replace nl2br means new line to break format. but when we need this functionality in our javascript code then what we do? We can do by simply manner: function nl2br(value) { return value.replace(/\n, ""); ...

Numeric validation require in mostly cases when we want that user enter only numeric value in any text field. For example 'Age' field. Obviously, age can not be in string format. function checkNumericValueValidation() { var enteredValue =...

Sometimes we need to develop a website with Hindi font. But main problem is how to insert content in Hindi in admin panel. so here is a solution by this admin can enter content in Hindi font. It will work like: When admin type any word like 'welcm' and...

Mostly all wordpress developers write the code to create widgets in admin side. and he use following code: var ajaxurl =''; var data = { action: 'action_function_name' }; // since 2.8 ajaxurl is always defined in the admin...

Today I have work in magento and work was save multiple dates in an attribute witout entering multiple values in one field. and need to provide multiple text box ( with date icon to select date )where user can select date and submit the form. On the...

My last two posts told to create javascript and html file. This post will tell you last step to drag and drop div are with pure javascript ( without jQuery ). Add below css code to head tags in the index.html file: body{ font-family: Trebuchet...

After reading my previous post Drag and Drop div area with pure javascript - Step 1, you have created javascript file draganddrop.js. Means you can add this javascript file to html page. so create a file index.html file and put below content in the head...

Today I have to work on drag and drop functionality and I found that on mostly sites it provides using Jquery but I have to develop with pure javascript. so I found best code for it. and this was the solution : First create a file draganddrop.js and put...

If you want to show any div area in the middle on click any link or button then follow these steps: 1. First download and add JQuery js in your file. 2. now create a function If you want to show any div area in the middle on click any link or button...

Javascript Trim Functions Use the code below to make trim a method of all Strings. These are useful to place in a global Javascript file included by all your pages. String.prototype.trim = function() { return...

In this post I simply showing how to find the cursor position in the window screen. function showPositionOnClick(evt) { var e = (window.event) ? window.event : evt; alert(e.clientX); } When user click on this button...

window.location and window.location.href will support to all browsers but it will not support to IE6. For this I have a solution: Suppose you code is : window.location = "http://naveenos.com/"; // Not working??? // Also this does not...

What is jQuery? Directly taken from the website of jQuery -” jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages”.It is...

Last time, I had published a poll asking which is the best PHP framework and in that poll Zend Framework stand out itself to be the most popular PHP framework among the PHP developers. This time ,I’ve come up with another Poll and I would you to...