how to include web js file and apply jquery

Hi folks

i have developed script for google maps address

I have load js files like

<script src="http://maps.googleapis.com/maps/api/js?key=#@#$$$#&sensor=false&libraries=places"></script>

and fire jqyery on input element like address

<input type="text" name="address"  style="width: 500px;"></input>

var autocomplete = new google.maps.places.Autocomplete($("input[name=address]")[0], {});

How can i load this js on Account Module .. How Can i apply jquery this on  $("input[name=billing_address_street]")

I have put all js file content in JsGrouping But  not work ...

How Can i do ???

Tevfik Tümer Angel Magana Ramana Raju Santhana

Parents
  • Hi Mehul Bhandari

    First copy all the content from maps.googleapis js file into custom file name it as gmaps.js file and move that file into your custom folder i.e

    ./custom/gmaps.js

    then create new grouping

    ./custom/Extension/application/Ext/JSGroupings/gmapsGrouping.php

    <?php
    $js_groupings[] = $gmapsGrouping = array(
        'custom/gmaps.js' => 'include/javascript/gmapsGrouping.js'
       
    );
    

    Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and create the JSGrouping extension. Once completed, navigate to Admin > Repair > Rebuild JS Grouping Files. This will create the grouping file shown below:

    ./cache/include/javascript/gmapsGrouping.js

    Now under Accounts module custom/modules/Accounts/Clients/base/views/record/record.js file

    initialize function add the following code:

    this.on("render", this.Getmap, this);

    now outside the function

    Getmap: function(){

    var autocomplete = new google.maps.places.Autocomplete($("input[name=address]")[0], {});

    }

    Hope this Helps

    Best Regards

    S Ramana Raju

  • Hi Ramana Raju Santhana

    Thanks ..

    only   ($("input[name=billing_address_city]")[0], {});

    not working

    any idea ??

Reply Children