Question: Comparing two textboxes javascript I am trying to create a diagram with plotly that will show the number of times there is an occurrence of

Comparing two textboxes javascript

I am trying to create a diagram with "plotly" that will show the number of times there is an occurrence of user specified letters in a string textbox, only if the letters are in the second input word textbox. See picture below.

Comparing two textboxes javascript I am trying to create a diagram with

My code so far compute and display the number of times each letter are in the input string textbox appears without verifying if the letters are in the input word textbox. What should I do if I only want the letters in the input string textbox shown in the diagram?

 function take(){ word=document.getElementById("inputword").value; sentence=document.getElementById("inputstring").value; var x = sentence.split(""); //Takes user sentence and splits every word. var histElements = { x: x, type: 'histogram', marker: {color: '#FFC300',}, }; var layout = { bargap: 0.05, bargroupgap: 0.5, barmode: "overlay", title: "Histogram", xaxis: {title: "Values",}, yaxis: {title: "Count"}, }; var data = [histElements]; //Using ID for div to plot the graph Plotly.newPlot('myDiv', data, layout); } 

Input String:aabmnccpddxdodeezffby Input Word: badcef Plot Histogram Histogranm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!