Sandeep Viradiya
Sandeep Viradiya

Reputation: 1

In Jquery dropdown menu

I have develope a program to get selected text from dropdown menu. This code is working in jsFiddle. but doesn't work in Browser. Is anything problem in jquery coding?

Dropdown

$(document).ready(function(){

    $('#ddl').change(function(){  
        var text= $('#ddl :selected').text();
        $('#ddltext').html(text);     
    });

});

CSPIT ADIT BVM DDIT Nirma

Thanks in advance.

Upvotes: 0

Views: 79

Answers (2)

Jamil Hneini
Jamil Hneini

Reputation: 555

Try disabling Plugins and change global variables name if it works with Jsfiddle not in browser this mean conflict in plugins scripts.
If this does not work please show us all of the codes to detect errors.

Upvotes: 0

maverickosama92
maverickosama92

Reputation: 2725

try this:

$('#ddl').change(function(){
    var text= $('#ddl option:selected').text(); 
    $('#ddltext').html(text);
});

working fiddle here: http://jsfiddle.net/APNFd/

i hope it helps.

Upvotes: 1

Related Questions