Top Questions

  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Sep 20, 2017

    Display countdown timer using jQuery.

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-countdown/2.0.2/jquery.countdown.min.js" ></script>
    
    /*html*/
    
    <span data-countdown="2017-09-25 12:10:01" ></span> // end date add here
    
    
    /*Jquery*/
    
    setTimeout(function(){
                    initCountDown()
    }, 300);            
    function initCountDown(){
        $('[data-countdown]').each(function() {
            var $this = $(this), finalDate = $(this).data('countdown');
            $this.countdown(finalDate, function(event) {
                $this.html(event.strftime('%D days %H:%M:%S'));
            });
        });
    }  
     
  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Nov 6, 2017

    To load a .js or .css file dynamically, in a head section, it means using DOM methods to first create a new "SCRIPT" or "LINK" element, assign it the appropriate attributes, and finally, use element.appendChild() to add the element to the desired location within the document tree. It sounds a lot more fancy than it really is. Lets see how it all comes together

    <script type="text/javascript">
    // function
    function loadheadfile(filename, filetype){
    	if(filetype=="js"){
    		var fileref=document.createElement('script')
    		fileref.setAttribute("type","text/javascript")
    		fileref.setAttribute("src", filename)
    	}
    	else if(filetype=="css") {
    		var fileref=document.createElement("link")
    		fileref.setAttribute("rel", "stylesheet")
    		fileref.setAttribute("type", "text/css")
    		fileref.setAttribute("href", filename)
    	}
    	if(typeof fileref!="undefined")
    		document.getElementsByTagName("head")[0].appendChild(fileref)
    }
    
    
    // call function
    loadheadfile('https://tsuyoshiwada.github.io/sweet-scroll/lib/icomoon/style.css','css');
    </script>
     
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Mar 22, 2016

    You can Create textarea into a rich content/text editor using jQuery.

    /***Footer part***/
    <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
    <script type="text/javascript">
            bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); // convert all text areas to rich text editor on that page
    
            bkLib.onDomLoaded(function() {
                 new nicEditor().panelInstance('area1');
            }); // convert text area with id area1 to rich text editor.
    
            bkLib.onDomLoaded(function() {
                 new nicEditor({fullPanel : true}).panelInstance('area2');
            }); // convert text area with id area2 to rich text editor with full panel.
    </script>
    /***HTML PART***/
    <!DOCTYPE html>
    <html>
    <head>
      <title>How to Create textarea into a rich content/text editor using jQuery</title>  
     
      <script type="text/javascript">
    //<![CDATA[
      bkLib.onDomLoaded(function() {
            new nicEditor({maxHeight : 200}).panelInstance('area');
            new nicEditor({fullPanel : true,maxHeight : 200}).panelInstance('area1');
      });
      //]]>
      </script>
    </head>
    <body>
    <h4>How to Create textarea into a rich content/text editor using jQuery</h4>
    <div id="sample">
      <h4>Simple textarea</h4>  
      <textarea name="area" id="area" style="width:70%;height:200px;">
           Some Initial Content was in this textarea
      </textarea>
      <h4>textarea with complete panel</h4>
      <textarea name="area1" id="area1" style="width:70%;height:200px;">
           Some Initial Content was in this textarea
      </textarea>
    </div>
    </body>
    </html>
  • 5.7 Years

    • Category : Php
    • Location : Unknown
    • Posted On : Mar 23, 2018

    How To Easily Add Product Variants To Your Clickfunnels 2-Step Order Form?

    <script>
    var option_name = 'product_color';
    var options = ['Red', 'Blue', 'Green'];
    var label = 'Pick A Color';
    
    $('.o2step_step1').prepend('<hr style="margin-top: 3px;margin-bottom: 15px;">');
    select = $('<select type="custom_type" data-custom-type="'+option_name+'" name="custom_type" class="elS1Fullname elInput elInput100 elAlign_left elInputSmall elInputStyl0 elInputBG1 elInputBR5 elInputI0 elInputIBlack elInputIRight required1 elInputStyle1 elInputSmall elInputBG2 garlic-auto-save" data-type="extra" style="margin-top: 0px !important;margin-bottom: 10px !important; border-color: rgb(74, 137, 32); border-width: 3px;"></select>');
    for(option in options) {
       select.append('<option>'+options[option]+'</option>');
    }
    $('.o2step_step1').prepend(select);
    $('.o2step_step1').prepend('<label>'+label+'</label>');
    </script>
     

    1 Answers

    View More
  • 5.11 Years

    • Category : Wordpress
    • Location : Mohali
    • Posted On : Feb 16, 2018

    Try this code in your functions.php file

    add_filter( 'woocommerce_billing_fields', 'woo_filter_state_billing', 10, 1 );
    add_filter( 'woocommerce_shipping_fields', 'woo_filter_state_shipping', 10, 1 );
    function woo_filter_state_billing( $address_fields ) { 
      $address_fields['billing_state']['required'] = false;
    	return $address_fields;
    }
    function woo_filter_state_shipping( $address_fields ) { 
    	$address_fields['shipping_state']['required'] = false;
    	return $address_fields;
    }
     
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Feb 4, 2017

    you can copy text to clipboard and paste where you want

    <button class="btn btn-success" id="copyButton" onclick="copyToClipboard('testing')">Copy</button>
    
    <script type="text/javascript">
    function copyToClipboard(elementId) {
    
      // Create a "hidden" input
      var aux = document.createElement("input");
    
      // Assign it the value of the specified element
      aux.setAttribute("value", elementId);
    
      // Append it to the body
      document.body.appendChild(aux);
    
      // Highlight its content
      aux.select();
    
      // Copy the highlighted text
      document.execCommand("copy");
    
      // Remove it from the body
      document.body.removeChild(aux);
    
    }
    </script>
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Jul 5, 2017

    Get geo location using jquery and save in a cookie

    var jb_lat = getCookie('jb_lat');
    var jb_lng = getCookie('jb_lng');
    
    if(jb_lat == '' && jb_lng == ''){
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(showPosition);
        } else { 
            x.innerHTML = "Geolocation is not supported by this browser.";
        }
        function showPosition(location){
            var exdays = 10;
            var d = new Date();
            d.setTime(d.getTime()   (exdays*24*60*60*1000));
            var expires = "expires="  d.toUTCString();
            document.cookie = "jb_lat="   location.coords.latitude   ";"   expires   ";path=/";
            document.cookie = "jb_lng="   location.coords.longitude   ";"   expires   ";path=/";
            window.location.reload();
        }
    
    }
        function getCookie(cname) {
            var name = cname   "=";
            var decodedCookie = decodeURIComponent(document.cookie);
            var ca = decodedCookie.split(';');
            for(var i = 0; i <ca.length; i  ) {
                var c = ca[i];
                while (c.charAt(0) == ' ') {
                    c = c.substring(1);
                }
                if (c.indexOf(name) == 0) {
                    return c.substring(name.length, c.length);
                }
            }
            return "";
        }
  • 5.11 Years

    • Category : Magento
    • Location : Mohali
    • Posted On : Apr 4, 2018

    When you’re getting a blank page in Magento 2.x or only error number like Error log record number: (any number), you can enable error reporting in Magento.

    // enable error messages in command line
    php bin/magento deploy:mode:set developer
    
    // enable error messages in file
    Add following code in index.php file :-
    
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    
    // disable error messages in command line
    php bin/magento maintenance:disable
    Goto app/etc/ and open env.php
    and change current application mode by MAGE_MODE' => 'default' to MAGE_MODE' => 'developer'

    Then,please flush the cache

    you can give a try by renaming local.xml.sample to local.xml under pub/errors
    • Category : Wordpress
    • Location : Unknown
    • Posted On : Jan 3, 2018

    How to create Word cloud with jquery

    How to create Jquery Word cloud with custom shapes .Like wordart.com.
  • 5.11 Years

    • Category : Wordpress
    • Location : Mohali
    • Posted On : Mar 14, 2018

    According to me if you want to remove all NEW link in wp admin area please follow this code

    add_action( 'admin_bar_menu', 'remove_wp_nodes', 999 );
    
    function remove_wp_nodes() 
    {
        global $wp_admin_bar;   
        $wp_admin_bar->remove_node('new-content');
    }