Your gMap.select has been updated here, and it's now functioning as desired.
select: function (buttonId){
gMap.buttons.$line.className="unselected";
gMap.buttons.$placemark.className="unselected";
document.getElementById(buttonId).className="selected";
var divs=window.parent.frames[0].document.getElementsByTagName('div');
for(i=0;i<divs.length;i++)
{
if(divs[i].id.charAt(0)=="c") divs[i].className="unselected";
}
var btn='c_'+buttonId;
window.parent.frames[0].document.getElementById(btn).className="selected";
}
Update : Find an updated fiddle here. Hope this meets your requirements.
Updates are indicated with // Update in the fiddle.
For another example of adding custom control with its event handler in Google Map using JavaScript, check out this link.
var map;
function initialize() {
map = new google.maps.Map(document.getElementById('map'));
map.setCenter(new google.maps.LatLng(48.77565,9.181802));
map.setZoom(12);
map.setMapTypeId( google.maps.MapTypeId.ROADMAP );
var controlDiv = document.createElement('div');
var table=document.createElement('TABLE');
var tbdy=document.createElement('TBODY');
var tr=document.createElement('TR');
var btn1=document.createElement('input');
btn1.setAttribute("type", "button");
btn1.id="c_placemark_b";
btn1.setAttribute("value", "Button One");
var td1=document.createElement('TD');
td1.appendChild(btn1);
var btn2=document.createElement('input');
btn2.setAttribute("type", "button");
btn2.id="c_line_b";
btn2.setAttribute("value", "Button Two");
var td2=document.createElement('TD');
td2.appendChild(btn2);
tr.appendChild(td1);
tr.appendChild(td2);
tbdy.appendChild(tr);
table.appendChild(tbdy);
controlDiv.appendChild(table);
google.maps.event.addDomListener(btn1, 'click', function() {
//DoSomething
alert(this.id);
});
google.maps.event.addDomListener(btn2, 'click', function() {
//DoSomething
alert(this.id);
});
controlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
}
My Chrome extension is running jQuery smoothly, except for dynamically created elements. It triggers an error message that reads: Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self& ...
import React from 'react'; import styles from './stylesheet.moudle.css' <div className={styles['first-style']} {styles['second-style']}> some content </div> What is the correct way to include styles[&ap ...
Here is the code I have implemented on my website for the Facebook Like and Share buttons. The functionality works seamlessly. When I click the Like button, a notification is promptly displayed on my Facebook profile page. Additionally, Facebook automatic ...
I am experiencing an issue with my AngularJS page where a popup is not displaying correctly. The popup HTML is fetched dynamically from the server using an AJAX request, including a new controller and relevant AngularJS code. The problem arises when the ch ...
I am working with a ul element that has a height of 270px and contains 10 li elements. My goal is to have all the li elements vertically justified, meaning the top and bottom li elements should touch the container's top and bottom respectively, while ...
Hovering over the text My will cause the image myicon.png to fade out and back in: <div class="mmItemStyleChild"> <img src="theImages/myicon.png" class="mIcon vertAlign mmm1" id="mMW1" /> <img src="theImages/emptyImg.png" class="mSpacer ...
I recently implemented code to easily share links with others in the same chat application by pressing a button. Now, I am trying to figure out how to obtain the current location and share it as a Google Maps URL within the chat app when the button is pre ...
I have a table with checkboxes for each row and I am trying remove the selected rows when a button is clicked. The selected row indexes are stored in an array using ng-change, but I cannot figure out how to delete them all at once with a single button clic ...
Is there a way to create a dynamic select list for year values using JavaScript? <form action="something"> some other fields <select id="year"> </select> </form> ...
I am attempting to dynamically change the background image, but I am having trouble accessing the wrapper before "wrapper:before{}" from jQuery $('.wrapper:before) .wrapper:before { content: ""; position: fixed; left: 0; right: 0; z-index: -1; displa ...
As I work on developing a discord bot, one area that I am focusing on involves implementing a database for certain functions. My current challenge revolves around creating a command that retrieves the names of all tables stored in the database. While I hav ...
<Select options={options} value={selectedBusinessList} isMulti placeholder="Select Business" onChange={(value: any) => setSelectedBusinessList(value)} onInputChange={query => { if ...
I have two simple objects that look like this. var obj1 = { "data": { "Category": "OUTFLOWS", "Opening": 3213.11, "Mar16": 3213.12, "Apr16": 3148.13, "May16": 3148.14, "Jun16" ...
I am dealing with an element that has three sub-elements element1, element2, and element3. When I press the button1 command, it filters element1. When I press the button2 command, it filters element2. How can I clone this element and manipulate both th ...
I've been having trouble getting this to work and I've attempted various solutions suggested by different sources such as: Display live width and height values on changing window resize php echo statement if screen is a certain size And more, b ...
How the Textfield below should load: https://i.sstatic.net/29Sz4.png How it actually loads: https://i.sstatic.net/TdPYM.png My Select component, created using Material UI and React form hook, is not loading the default value as expected. The component ...
I've spent the entire day trying to figure out why this isn't working. Here's a simplified version of the HTML table using Vue v-for: <table id="timeSheet-datatable" class="table table-striped dt-responsive w-100"> ...
I've got a SCSS file containing an array of color values. export const COLORS = { transparent: 'rgba(0,0,0,0)', primary: '#09596e', primary01: '#317D92', primary02: '#6BADBF', primary03: '#97C6D2& ...
Recently, I encountered a problem in my Kendo MVC project where I needed to drag a product code from one Kendo Grid to another when the cell value was empty. Here's the scenario: Grid A contains products ordered, but the vendor sending the list has i ...
Is there a way to programmatically simulate clicking on the download button on the following website using R and download the TSV table? I have looked into methods such as Rselenium and PhantomJS, but they seem to be outdated now. I came across V8 as a po ...