Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get value of input element in event listener with d3

I have two html elements:

<input id="searchInput">
<div id="searchText"></div>

I'm using d3 to add a listener in a script.

d3.select("#searchInput").on("keyup",getSearchText);

I need a function that prints a value of input to a div

function getSearchText(value) {
d3.select("#searchResults").html(value.toString());
}

But I don't know how to pass input value parameter to a listener function.

like image 593
nextstopsun Avatar asked Oct 25 '25 02:10

nextstopsun


1 Answers

I've found solution:

d3.select("#id").node().value
like image 151
beloblotskiy Avatar answered Oct 26 '25 16:10

beloblotskiy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!