Click here to Skip to main content
15,499,594 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionhow to convert a function in to arrow function Pin
Member 139980429-Jan-21 1:56
MemberMember 139980429-Jan-21 1:56 
AnswerRe: how to convert a function in to arrow function Pin
Afzaal Ahmad Zeeshan9-Jan-21 5:35
mveAfzaal Ahmad Zeeshan9-Jan-21 5:35 
SuggestionRe: how to convert a function in to arrow function Pin
Richard Deeming11-Jan-21 23:41
mveRichard Deeming11-Jan-21 23:41 
QuestionQuiz Issue Pin
Shobhit Rathour30-Dec-20 4:35
MemberShobhit Rathour30-Dec-20 4:35 
AnswerRe: Quiz Issue Pin
Afzaal Ahmad Zeeshan9-Jan-21 6:02
mveAfzaal Ahmad Zeeshan9-Jan-21 6:02 
QuestionReplacing the eval() function with something faster, more safe Pin
jkirkerx21-Dec-20 8:52
professionaljkirkerx21-Dec-20 8:52 
AnswerRe: Replacing the eval() function with something faster, more safe Pin
Graham Breach21-Dec-20 9:27
MemberGraham Breach21-Dec-20 9:27 
GeneralRe: Replacing the eval() function with something faster, more safe Pin
jkirkerx21-Dec-20 10:21
professionaljkirkerx21-Dec-20 10:21 
That was going to be my next question.

I got that error about missing name after dot operator, and tried working with dots.
So I started working on it, but didn't get it to work right. Then I realized that the original author just wanted to make sure that the right select element was chosen, so I sent "this" to the function.
HTML
From this:
<select id='$sel_cat_name' name='$sel_cat_name' onchange='return check_supplier($sel_cat_name)'>

To this:
<select id='$sel_cat_name' name='$sel_cat_name' onchange='return check_supplier(this, $sel_cat_name)'>
And adjusted the function

From this:
JavaScript
function check_supplier(opType) {        
    const form_ele_name = "document.form2." + op_type + ".selectedIndex";
    let tmp_sel_index = eval(form_ele_name);

    const form_sel_name = "document.form2."+op_type+".options["+tmp_sel_index+"].text";
    let sel_ven_name = eval(form_sel_name);
To This:
JavaScript
function check_supplier(sourceElement, opType) { 
     const tempSelectIndex = sourceElement.selectedIndex;
     const formSelectName = sourceElement.options[tempSelectIndex].text;
     let selectVendorName = eval(formSelectName); 
I don't know, guess it could be re imagined several different ways. But your help is of great value to quickly fix this.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

Questionhigher order functions Pin
atomattacker-png21-Dec-20 2:49
Memberatomattacker-png21-Dec-20 2:49 
AnswerRe: higher order functions Pin
Richard MacCutchan21-Dec-20 3:06
mveRichard MacCutchan21-Dec-20 3:06 
GeneralRe: higher order functions Pin
atomattacker-png21-Dec-20 3:21
Memberatomattacker-png21-Dec-20 3:21 
GeneralRe: higher order functions Pin
Richard MacCutchan21-Dec-20 4:13
mveRichard MacCutchan21-Dec-20 4:13 
GeneralRe: higher order functions Pin
Richard MacCutchan21-Dec-20 5:02
mveRichard MacCutchan21-Dec-20 5:02 
GeneralRe: higher order functions Pin
atomattacker-png21-Dec-20 5:36
Memberatomattacker-png21-Dec-20 5:36 
GeneralRe: higher order functions Pin
Richard MacCutchan21-Dec-20 5:44
mveRichard MacCutchan21-Dec-20 5:44 
QuestionAttempting to pre-populate text field and mailto based on ID Pin
Member 1502531419-Dec-20 2:10
MemberMember 1502531419-Dec-20 2:10 
QuestionLooking to run a PHP page in the background using pure Javascript Pin
jkirkerx17-Dec-20 14:50
professionaljkirkerx17-Dec-20 14:50 
AnswerRe: Looking to run a PHP page in the background using pure Javascript Pin
DerekT-P17-Dec-20 23:54
professionalDerekT-P17-Dec-20 23:54 
GeneralRe: Looking to run a PHP page in the background using pure Javascript Pin
jkirkerx18-Dec-20 7:10
professionaljkirkerx18-Dec-20 7:10 
GeneralRe: Looking to run a PHP page in the background using pure Javascript Pin
DerekT-P18-Dec-20 8:11
professionalDerekT-P18-Dec-20 8:11 
GeneralRe: Looking to run a PHP page in the background using pure Javascript Pin
jkirkerx18-Dec-20 8:53
professionaljkirkerx18-Dec-20 8:53 
GeneralRe: Looking to run a PHP page in the background using pure Javascript Pin
DerekT-P18-Dec-20 9:26
professionalDerekT-P18-Dec-20 9:26 
GeneralRe: Looking to run a PHP page in the background using pure Javascript Pin
jkirkerx18-Dec-20 9:47
professionaljkirkerx18-Dec-20 9:47 
AnswerRe: Looking to run a PHP page in the background using pure Javascript Pin
jkirkerx18-Dec-20 13:27
professionaljkirkerx18-Dec-20 13:27 
AnswerRe: Looking to run a PHP page in the background using pure Javascript Pin
jkirkerx18-Dec-20 14:31
professionaljkirkerx18-Dec-20 14:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.