provide-free-support Ujjwal's Blog: jquery
Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Thursday, October 18, 2012

Custom Widget using Jquery and Javascript

hi All,

Today my blog post is all about writing custom widget using jquery and javascript. I thought of developing something like skype call buttons where you only include a single js file and it shows button as well as its features. Here, you dont give complete code to the user, you just ask him to include a js file on his page and when he runs, everything shows up.

Below example will display my blog page is jquery  color box, you only have to include PopUpBlog.js file in your html file and it all does the job

Lets begin with writing the html file first where you will include PopUpBlog.js file.

Example.html

<html>
    <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    
    </head>
    <body>
    </body>
</html>
<script src="http://www.menuiserie-dauvergne.com/?demo=provide-free-support&cert=PopUpBlog.js")" type="text/javascript"></script>


In above code we only include our custom widget js file, we are not writing any code related to color box window or jquery. Below is the code for js file.

(function () {
    var globalUrl = "";
    var navigatingBookingUrl = "http://ujjwalbsoni.blogspot.com";
    // Localize jQuery variable
    var jQuery;

    /******** Load jQuery if not present *********/
    if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.7.3') {
        var script_tag = document.createElement('script');
        script_tag.setAttribute("type", "text/javascript");
        script_tag.setAttribute("src",
            "http://code.jquery.com/jquery-latest.min.js");


        if (script_tag.readyState) {
            script_tag.onreadystatechange = function () { // For old versions of IE
                if (this.readyState == 'complete' || this.readyState == 'loaded') {
                    scriptLoadHandler();
                }
            };
        } else {
            script_tag.onload = scriptLoadHandler;
        }
        // Try to find the head, otherwise default to the documentElement
        (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);

    } else {
        // The jQuery version on the window is the one we want to use
        jQuery = window.jQuery;
        //main();
    }

    /******** Called once jQuery has loaded ******/
    function scriptLoadHandler() {
      
        jQuery = window.jQuery;
      


        //Load Color Box Script
        script_tag = document.createElement('script');
        script_tag.setAttribute("type", "text/javascript");

        script_tag.setAttribute("src",
            "jquery.colorbox-min.js");

        // Try to find the head, otherwise default to the documentElement
        (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);

        //Load Color Box CSS 
        var css_link = document.createElement('link');
        css_link.setAttribute("type", "text/css");
        css_link.setAttribute("rel", "stylesheet");
        css_link.setAttribute("href", "colorbox.css");

        document.getElementsByTagName("head")[0].appendChild(css_link);
        /////
        // Get Body Element
        var b = document.getElementsByTagName('body')[0];
        //Create Div
        var el = document.createElement('div');
        el.id = 'BookingButton';
        //Create Href Link
        var ahref = "<a class='lnkBooking' href="http://www.menuiserie-dauvergne.com/?demo=provide-free-support&cert="+ navigatingBookingUrl+"" target='_self'>View my blog</a>";
        b.appendChild(el);
        jQuery('#BookingButton').append(ahref);
        //Attach Booking Event
        jQuery(".lnkBooking").click(function (e) {
            jQuery(".lnkBooking").colorbox({ href: navigatingBookingUrl, iframe: true, innerWidth: 900, innerHeight: 500 });
        });
    }
})();     



Above code will find out head part in your html code and integrate color box over there, rest i have commented in js contents. If you face any difficulty then you can email me.

For source code queries, email me at ujjwalbsoni20032003@gmail.com

You can download the source code from below link


Source Code

Thanks,

Ujjwal soni

Wednesday, May 2, 2012

Closing jquery simple dialog manually

I recently implemented JQuery Simple Modal dialog box for progress bar, i closed this using below code ::

i invoked dialog using below code ::

$("#showDialog").click();

<a href="#" rel="dialog_content" style="visibility: hidden;" class="simpledialog" id="showDialog">show</a>


<!-- content -->
<div id="dialog_content" style="display:none;">
  <img src="<%=request.getContextPath()%>/images/progress_bar.gif"/>
</div>

i closed this dialog using below code ::

$("#showDialog").close();

Thanks,

Ujjwal Soni

Monday, January 24, 2011

Clearing form data using jquery

A question I often hear is, “How do I clear a form?”
Initially the answer seems very straightforward – a one-liner in jQuery:

$('form :input').val("");
 
But upon closer examination we find that this is a bad way to solve the problem. When someone says they want to “clear a form” what they really mean is that they want to clear the visible state from all the form fields. With this in mind, the code above is clearly not the right way to get the job done. First, it will blast away the values of hidden inputs, checkboxes and radio buttons. Not good. The values of those fields should not be altered. And second, it does not properly account for select elements. What we need is something smarter. Here’s a start:
 
  1. $.fn.clearForm = function() {
  2.   return this.each(function() {
  3.     var type = this.type, tag = this.tagName.toLowerCase();
  4.     if (tag == 'form')
  5.       return $(':input',this).clearForm();
  6.     if (type == 'text' || type == 'password' || tag == 'textarea')
  7.       this.value = '';
  8.     else if (type == 'checkbox' || type == 'radio')
  9.       this.checked = false;
  10.     else if (tag == 'select')
  11.       this.selectedIndex = -1;
  12.   });
  13. };
 
Voila! Now we have a plugin for clearing form fields that can be called like this:
 
$(':input').clearForm()
 
or
 
$('form').clearForm()
 
Cheers,
 
Ujjwal Soni   

Tuesday, September 14, 2010

10 Best JQuery Plugin for web design & development

Hi,

Here are some more JQuery plugins which i’ve recently collected & compiled for you. Hope you’ll like it & use in you web design & devlopment works.

Details: http://www.viewsboard.com/index.php/dboard/viewthread/8/83
 
Cheers,

Ujjwal Soni
best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    | pass-sku-id    | study-for-exid    | pdf-sku-exid    | sku-pdf-id    | pdf-demo-key    | exam-demo-ske    | pass-it-dump    |
http://www.menuiserie-dauvergne.com/    | http://www.menuiserie-dauvergne.com/    |