Dropdown values are not populating - javascript

I Can see values coming through in console but the same values are not getting displayed in a webpage(Attached image(s) for easy imagiantion).
Can someone help me with the possible/expected scenarios.
Can't see values in dropdown.
Values are present/seen in console
P.S: It works well when I use Chrome browser and its a cascading menu.

Usage of "this" keyword got me in to this problem. While on my research I've used "document.getElementByID" to fetch values dynamically instead this keyword.
Thanks for your time.It's working now.
Edit: Kind of issue to one of my mates, he forgot to add text-size.

Related

Algolia and WordPress search page suddenly not working, console showing "Uncaught typeError"

I built a search page with WordPress & Algolia Search, and it's been working fine for a few months, but suddenly, I am getting the following error:
Uncaught TypeError: Cannot read property 'matchedWords' of undefined
The facet filters are no longer working and the search results are not being displayed.
Page in question is: https://habyts.com/activities-for-kids
I can't pinpoint anything having changed since it stopped working, so I don't really know how to fix this error.
The Algolia WordPress plugin has been updated a few days ago to 2.3.0, but I loaded the search page a few times after the update and it was working, it's only a day or so after the update that it broke and started showing the console error.
Please help!
Thanks in advance.
The Uncaught TypeError: Cannot read property 'matchedWords' of undefined error is raised because there is a field that no longer is present in your Algolia index.
From version 1.x to 2.x of the plugin, there have beens some changes and we have already seen this error once.
To solve it, you need to manually delete all the indices from your Algolia dashboard, and then trigger re-indexing of all the indices from the admin of the Algolia plugin.
In case you also did customize the autocomplete/search page template, you would need to make sure the fields used in those are still available in the data sent to Algolia.
I deleted all my Algolia Indices, and reindexed everything required, and reverted back to my old instantsearch hit template, which indeed worked again, with search highlighting working again.
One thing doesn't work though. I was previously using data.images.medium to display thumbnails of each search result. For some reason this no longer works, as in no image is displayed. There are no console errors present and I can't figure out what's changed.
I can get data.images.thumbnail working to display a thumbnail with each search result. I want however to grab a higher resolution image, which I was previously able to do using data.images.medium...
Any ideas?
I found out the answer from this post - https://discourse.algolia.com/t/image-size-on-instantsearch-page/1593/2
Since version 2.x, all image sizes are not returned with each search since it incurs performance issues.
To return custom image sizes other than thumbnails this code needs to be added to a plugin / functions file.
add_filter('algolia_post_images_sizes', function($sizes) {
$sizes[] = 'medium';
return $sizes;
});
Once this code has been added to functions or your own custom plugin file, you'll need to reindex everything and then your chosen custom image sizes should start to work.
Hopefully this is helpful.

OpenLayers print function not working

Taking the function as in Save google map as an image - using javascript (able to take screenshot) , the solution ceased to work, as it is now generating an error on
var comp=transform.split(",");
It seems that the object returned by
$(".gm-style>div:first>div")
doesn't have the css property.
Does anyone know what's going on?
Thanks is advance
ok, i got it to work using
$(".olMapViewport>div:first>div").css("transform");
it seems that .gm-style may not work in some situations.

jQuery select box val undefined in IE9

I am facing a bug for now more than 2 hours.
I have a javascript code that generate (from json) a two levels select box for task and subtask.
I just figured out that this code doesn't work on IE9 and maybe other versions, and I was not able to find out why.
I created a JsFiddle to show you my code
http://jsfiddle.net/jkU6Y/18/
The goal is just to find the subtask ID to send via ajax or the task ID if the subtask is not selected.
On IE, I can't get this value and it return undefined.
document.write won't register the HTML you are writing out with the DOM in IE. Try to append it to body:
$("body").append($(html));
I cleaned my code and now it's working, so I think that the problem came from the fact that two or more elements may in certain situation have the same ID.
Thanks for your help cbayram and Jan Dvorak, have a good day !

Opera: trouble with adding 'list' attribute

Today I've decided to add html5 datalist to certain input via user script. Here's the code. The problem is that list attribute isn't added. If I change it to anything different from list, like lst - it's there.
Is that supposed to be so? Is such behaviour set by specification or by browser?
OK, I did some research on this.
Spec says that input.list returns related datalist object, not the attribute value. So you should use setAttribute('list','edit-subject-themes') on input, which works fine. Seems like it was jQuery issue.
With problem solved, I'll sure use that technique in user JavaScript a lot :)

Javascript/CSS drop downs not working

I am trying to add css dropdowns to the navigation menu. But it is not working. I would like to know what is causing the problem. Your help is highly appreciated. Here is the link:
Drop downs to navigation bar
The error that I get is that ddlevelsmenu is not defined... is there some sort of initialization you have to do for the library you're using?
EDIT: Ahhh, there's the problem. I looked up this library: you need to be including ddlevelsfiles/ddlevelsmenu.js, but you are not. Include that, and re-read
http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/index.htm
to make sure you got everything in there you need, then you should be set!
Ahh! You never closed the tag. Change to and I bet you it will work. Those little typos can be the nastiest =

Categories

Resources