Home > front end >  The same page multiple select multiple onChange could you tell me how to write?
The same page multiple select multiple onChange could you tell me how to write?

Time:10-18



Have multiple select box on this page after selection of product selection in the back of the unit price column shows the corresponding prices

Can you tell me how to write?

CodePudding user response:

After selecting the incoming current control to the function, can find the current line, locate other controls in the current line

CodePudding user response:

A single select name I implemented effect but multiple select is uncertain

CodePudding user response:

If rendering a row saved a unified value (such as the entry id [data - id='XXXX']), consider circulation judge current onChange data - id corresponds to the price positioning

CodePudding user response:

$("... "). The change (function (event) {
$(this). The closest (" tr "). The find (". The unit price column element class "). The text ($(this). Val ());
});

CodePudding user response:

I'm don't know what's wrong with JS wrote a great god help see
 & lt; Table width="100%" & gt; 

<"Width=" 18% "& gt; Project & lt;/th>
<"Width=" 30% "& gt; Name & lt;/th>
<"Width=" 12% "& gt; The unit price & lt;/th>
<"Width=" 18% "& gt; Quantity & lt;/th>
<"Width=" "& gt; Price & lt;/th>

Value (' name ')} {$& lt;/td>










 & lt; The script type="text/javascript" & gt; 
The function changeCollege () {
//to extract the name of commodity name
Var class_name=document. GetElementsByName (" class_name ");
//to extract price name name
Var moeny=document. GetElementsByName (" moeny ");
//circulation commodity name
for(var i=0; i//name of commodity choice event
Class_name [I] onclick=function () {
//print price to the web page
The console. The log (enclosing the value);
//moeny [I] innerHTML=000;
}
}
}
</script>

CodePudding user response:

 
Div elements do not have a name attribute, need to use a class for the


Var moeny=document. GetElementsByClassName (" moeny ");

Within the event using the loop variable outside need to preserve the value of each loop in closure
for(var i=0; i(function (I) {
Class_name [I] onclick=function () {
Moeny [I] innerHTML=this. The value;
}
}) (I);
}

CodePudding user response:

On a web page click right click on the drop-down box on his mobile phone products will no longer display price point after out
If can't use the onChange event
  • Related