Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The path that generates the action="undefined" value is this:

JavaScript
var value_1_2 = d3.select(this).property("market");
document.querySelector('#botao-de-jogo-betfair-1').action = value_1_2;


CSV file "Lista_de_Jogos.csv" is:

label,value,market
,,
house,car,work


The selection box perfectly shows both attributes:

HTML
<option value="car" market="work">house</option>


But when I select this , instead of action of #botao-de-jogo-betfair-1 keep the value work he gets the value undefined:


HTML
<form id="botao-de-jogo-betfair-1" action="undefined" target="_blank">
					<input type="submit" style="width: 100%;" value="Jogo Betfair 1">
				</form>


Note: when I try to use .property("value") returns the value car perfectly.

What I have tried:

JavaScript
<script src="https://d3js.org/d3.v4.js"></script>
<script id="script-da-caixa-de-selecao-suspensa-1">
	var select_1 = d3.select("#caixa-suspensa-1")
	.append("select")
	.attr("id","select-box-1")
	.style("width","100%");
	
	function caixa_suspensa_1(data) {
	select_1
		.on("change", function(d) {
		var value_1 = d3.select(this).property("value");
		document.querySelector('#barra-de-texto-para-radar-1').value = value_1;
		document.getElementById('botao-do-radar-1').click();
		var value_1_2 = d3.select(this).property("market");
		document.querySelector('#botao-de-jogo-betfair-1').action = value_1_2;
		});
	let update_1 = select_1.selectAll("option")
		.data(data);
	update_1.exit().remove();
	update_1.enter().append("option").merge(update_1)
		.attr("value", d => d.value)
		.attr("market", d => d.market)
		.text(d => d.label);
	}
	d3.csv("Lista_de_Jogos.csv", function(data){caixa_suspensa_1(data)});
</script>
Posted
Updated 29-Aug-21 12:58pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900