Categories
jQuery

Access iframe in jQuery

Sometimes it is very difficult to get content which is present in iframe. In this case normal javascript will not work. Here is a simple code to access iframe in jQuery: $(‘#frame1’).load( function(){ $(this.contentDocument).find(‘body’).html(‘This frame was modified with jQuery! Yay!!!’) });

Categories
jQuery

jQuery tips and tricks

In this article you will learn about few jQuery tips and tricks of interesting. Until you practice, you will not be able to be master of jQuery. jQuery tips: To check if checkbox is checked: if ($(“#checkID”).is(‘:checked’)) { … } or if ($(‘#checkID’).attr(‘checked’)) { … } Check whether an element exists or not: if ($(“#myDIV”).length) […]

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
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
jQuery

SlidesJS, a jQuery responsive slideshow plug-in

SlidesJS is a jQuery responsive slideshow plug-in for version 1.7.1+ with various features like responsive, CSS3 transition. It has the following features: Responsive CSS3 transitions Touch effect Easy setup Options width (number) & height (number) start (number) navigation (object) pagination (object) play (object) effect (object) callback (function) Here is a simple example: <!doctype html> <head> […]

Categories
jQuery

Clear form fields with exception in jQuery

Using jQuery you can clear form fields. Here I am going to describe, how we can clear all of the fields except a few using jQuery. Example of Clear form fields: <div id=”mainDiv”> <input type=”text” id=”txt1″ /><br/> <input type=”text” id=”txt2″ /><br/> <input type=”text” id=”txt3″ /><br/> <input type=”text” id=”txt4″ /><br/> <button id=”clearall”>Clear All</button> </div> Now, we […]

Categories
jQuery

Skilful act jQuery tips and tricks

jQuery is a JavaScript library which is simple, light-weight, open source, cross browser and simplifies animations, event handling, and developing Ajax-based web applications and promotes rapid application development. Here are few jQuery tips: Check Element Exists if ($(“#element”).length) { … } Check Element Is Visible if($(“#element”).is(“:visible”) == “true”) { … } Disable Right Mouse Click […]

Categories
jQuery

CSS Hooks – jQuery

jQuery lets you a way to write down your own custom CSS methods. CSS Hooks directly into jQuery to override custom properties. I think you have written so many time in your website for different location. Isn’t it? $(“div”).css(“margin”, “0px 1px 2px 3px”); But using CSS Hooks, you can easily add the above code to […]

Categories
Javascript jQuery

Tips and Tricks for powerful developers

Here we will discuss few jQuery techniques and Tricks for powerful developers which is useful for library. So starts with a few tips about performance & continue with little introductions to some of the jQuery library’s more features. Use selectors as simple You should try to optimize the way you get elements not to force […]