Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  21] [ 1]  / answers: 1 / hits: 31263  / 12 Years ago, tue, september 25, 2012, 12:00:00

Here is my javascript code, i want to pass current selected value of the option to my js function, in this code i used static number 6.



<select name='project_name' class='required input_field' id='project_name' onchange=sendRequest('GET','getClientName.jsp?ProjectId=6')>
<option value=''>-- Select --</option>
<option value=1>Project 1</option>
<option value=2>Project 2</option>
<option value=3>Project 3</option>
</select>


help me to solve this...


More From » javascript

 Answers
19

Change the string 'getClientName.jsp?ProjectId=6' to



'getClientName.jsp?ProjectId=' + this.options[this.selectedIndex].value)


or



'getClientName.jsp?ProjectId=' + this.value)


but I think the first one is more browser compatible.


[#82923] Sunday, September 23, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaileya

Total Points: 168
Total Questions: 95
Total Answers: 72

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;