Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
Why doesn't the onchange script work?

Can anyone help me please?

When you user selects Internal Transfer or External Transfer from the Resolution drop down then it should bring another drop down

http://jsfiddle.net/m8ck7/2/
Posted
Updated 23-Jul-14 3:33am
v4
Comments
hollysong 23-Jul-14 8:49am    
If you don't write Javascript then doesn't work :) Javascript panel is empty on your jsfiddle link.
padders01 23-Jul-14 8:53am    
It doesn't work on my webpage either, I have just lifted the code and put it on a jsfiddle
TrushnaK 23-Jul-14 9:25am    
can you put your javascript code there...
SRS(The Coder) 23-Jul-14 9:32am    
Please check, i have updated the fiddle itself with solution you want or you can check with the code i posted as answer here. Please ensure that you have included the jQuery file before running it at the left hand side of fiddler.
padders01 23-Jul-14 9:36am    
Doesn't quite work, as if you select Internal Transfer, then another selection then the drop down stays there.

Also adds another box if you select Internal Transfer first, then External Transfer second.

The onchange javascript should work, I have it working on other pages, just can't get it working on this for some reason

Thanks for your help

Gone through your scenario and code you shared :-

Can you please check with the below jQuery code as it worked for me. :-)

JavaScript
$(function(){
    var vNewSelect = '<select name="new" id="idNew"><option value=""></option><option value="test1">Test1</option><option value="test2">Test2</option></select>';     
    $('#Resolution').change(function(){
        if(($('#Resolution option:selected').val() == 'Internal Transfer')  || ($('#Resolution option:selected').val() == 'External Transfer')){
        $( vNewSelect ).insertAfter( "#Resolution" );
        }else{
        }
    });
});


Hope you also will be helpful with the code shared.
 
Share this answer
 
Refer below fiddle link to call javascript function on select onchange event.

http://jsfiddle.net/Wf3g2/271/[^]

There is a demo code for calling javascript function from onchange event.
Edit the javascript code apply logic and get what you want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900