Hi Support, I have a dropdown box and want to launch a javascript function from that dropdown events. The event allows only 1 liners. My script has multiple lines as per below: This works if adding the JavaScript for page load on the setup TAB / load javascript and will populate my dropdown, but I want to launch it from a selection in a dropdown EVENT option. Can you help?
Script I wish to run from the dropdown EVENT:
window.onload = function () {
jQuery.get('http://myserver/data/mytextfile.txt?t='+new Date().getTime(), function(data) { var textArea = data;var arrayOfLines = textArea.split("\n");var index;var a = arrayOfLines;
for (index = 0; index < a.length; ++index) {
var x = document.getElementById("MyDropdown");
var option = document.createElement("option");
option.text = a[index];
x.add(option);
}
});
};
Script I wish to run from the dropdown EVENT:
window.onload = function () {
jQuery.get('http://myserver/data/mytextfile.txt?t='+new Date().getTime(), function(data) { var textArea = data;var arrayOfLines = textArea.split("\n");var index;var a = arrayOfLines;
for (index = 0; index < a.length; ++index) {
var x = document.getElementById("MyDropdown");
var option = document.createElement("option");
option.text = a[index];
x.add(option);
}
});
};