I'm trying to init 2 libraries (adsense and places) in one line
I try this
<script type="text/javascript" src="http://maps.google.pl/maps/api/js?sensor=true&language=pl&output=embed&libraries=adsense;libraries=places"></script>
And this:
<script type="text/javascript" src="http://maps.google.pl/maps/api/js?sensor=true&language=pl&output=embed&libraries=adsense&libraries=places"></script>
But this isn't working:( How it should be
http://code.google.com/apis/maps/documentation/javascript/libraries.html says:
Multiple libraries may be specified as a comma-separated list.
So try adsense,places, ie.
<script type="text/javascript" src="http://maps.google.pl/maps/api/js?sensor=true&language=pl&output=embed&libraries=adsense,places"></script>
Related
I'm using a many-to-many field in my django model, exposing it on the admin interface and trying to use a filter_horizontal widget. Now, I've added some custom html to my change_form.html so simply adding a filter_horizontal = ('teams', 'players', ) is not helping.
I googled around, and found out that the widget requires some default js, so I went ahead and included the following in my change_form.html
<script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin/js/SelectBox.js"></script>
<script type="text/javascript" src="/static/admin/js/SelectFilter2.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
I see the following error in my browser's console right now:
Uncaught ReferenceError: interpolate is not definedinit #
SelectFilter2.js:47 (anonymous function) # (index):1275
Digging into the SelectFilter2.js, I found that it requires a file addevent.js. I'm guessing this is where the interpolate function would've been defined since all other imports are satisfied. But I cannot find any such file in my project, and google did not help out on this. Can anyone help me here? What am I missing?
So for whatever it's worth, the horizontal filter didn't work, and this did the job for me easily so I went ahead with this:
raw_id_fields = ('teams', 'players', )
Also, please don't forget to include the following in your custom template for this widget to work:
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
Something peculiar is happening for me with jquery-ui. I'm importing several pieces of jquery-ui separately in my HTML:
<script type="text/javascript" src="../third-party/jquery-1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="../third-party/jquery-ui-1.10.4/jquery-ui.core.min.js"></script>
<script type="text/javascript" src="../third-party/jquery-ui-1.10.4/jquery-ui.widget.min.js"></script>
<script type="text/javascript" src="../third-party/jquery-ui-1.10.4/jquery-ui.mouse.min.js"></script>
<script type="text/javascript" src="../third-party/jquery-ui-1.10.4/jquery-ui.datepicker.min.js"></script>
Yet, when I load the HTML, I get undefined is not a function when my javascript attempts to use $.widget. The offending line in jquery-ui.widget.js is:
basePrototype = new base();
I'm perplexed. Did I miss a dependency somewhere? It doesn't seem like I did, but I must be missing something. I also tried it with the jquery-ui.custom.js that jquery-ui's website provided instead, to no avail. I'm always including jquery first.
I think this one is relevant:
jQuery.ui.draggable.js and jQuery.ui.widget.js conflict
Try if top answer in this question works for you.
I am getting error message in firebug saying "TypeError: $ is not a function" and the code of small javascript underneath.
The full code is here:
<script type="text/javascript">
$('#editvalue').click(function(e){$('#storedvalue').hide();$('#altervalue').show();});
$('#savevalue').click(function(e){
var showNew = $('#file').val();
$('#altervalue').hide();
$('#storedvalue').show();
$('#storedvalue span').text(showNew);
});
</script>
Can anyone help me with this? I am not into javascript programming. Thanks in advance!
Edit: This is what sits in my head section:
<script type="text/javascript" src="scripts/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="scripts/sfm_validatorv7.js"></script>
<script type="text/javascript" src="scripts/sfm_validate_jobform.js"></script>
<script type="text/javascript" src="scripts/rollover_images.js"></script>
<script type="text/javascript" src="slideshow/fadeslideshow.js"></script>
<script type="text/javascript" src="scripts/setslides.js"></script>
Do I need to add one more line with just "jquery.js" and upload this file to a server or I am missing something here, looks like all is ok above, thats why I am asking for help.
You've tagged this jQuery. jQuery is a library that provides a function called $, but you have to include the script that provides the library before you can use it.
<script src="path/to/jquery.js"></script>
For other options, see the jQuery download page, with special attention to the section on using a CDN.
1: include the script that provides the jQuery library and try;
2: find out that is there any other scripts contain this tag "$", you can use jQuery to instand of.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=.......&sensor=false&libraries=places"></script>
I want to add &libraries=geometry into the script above, how describe it?
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=.......&sensor=false&libraries=places&libraries=geometry"></script>
or
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=.......&sensor=false&libraries[]=places&libraries[]=geometry"></script>
According to the documentation, you should give multiple libraries comma-separated:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=.......&sensor=false&libraries=places,geometry"></script>
you cannot specify to variables with the same name, the post/get script will only handle one of those
I suggest you replace 'libraries=places&libraries=geometry' with 'libraries=places,geometry' and see how that works for you.
I include the following in my header
<!-- scripts -->
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript" src="./js/script.js"></script>
<script type="text/javascript" src="./js/jquery.infinitecarousel.js"></script>
<script type="text/javascript" src="./js/news.ticker.js"></script>
<script type="text/javascript" src="./js/jquery.autogrowtextarea.js"></script>
but the autogrowtextarea dont work if the script.js,jquery.infinitecarousel.js and news.ticker.js are included, but if i remove those three lines my autogrow textbox function work, why can this be. thanks
That means that something in one or all of those scripts is masking or breaking the functionality, or something on which it depends. Try not including the scripts one by one; isolate which one causes the break. Then look for duplicate definitions. Also, make sure that the scripts are included in the right order if there are any dependencies.
Try to put <script type="text/javascript" src="./js/jquery.autogrowtextarea.js"></script> next to the include of jquery and before the other ones and test if works. Maybe you have dependencies in the other files (script.js)