Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

selected item from dropdownlist

$("#ddrp1").change(function() {
    // Pure JS
    var selectedVal = this.value;
    var selectedText = this.options[this.selectedIndex].text;

    // jQuery
    var selectedVal = $(this).find(':selected').val();
    var selectedText = $(this).find(':selected').text();
});


/*	In jQuery 1.7, you can use .on()	*/

$("#ddrp1").on("change", function() {
    // Pure JS
    var selectedVal = this.value;
    var selectedText = this.options[this.selectedIndex].text;

    // jQuery
    var selectedVal = $(this).find(':selected').val();
    var selectedText = $(this).find(':selected').text();
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: what does react js allows us to do 
Javascript :: google.translate.TranslateElement part of page 
Javascript :: Subtracting Numbers in Array 
Javascript :: this ....object of. 
Javascript :: javascript coding test interview 
Javascript :: vscode react debug chrome profile 
Javascript :: is enabled 
Javascript :: Getting Specific Element Properties 
Javascript :: angular cache interceptor 
Javascript :: same onclick function on different elements and change another element 
Javascript :: react hooks remove item from array 
Javascript :: shipengine connect 
Javascript :: console form elememts as json object 
Javascript :: change candle color react highcharts 
Javascript :: why in the hell does JavaScript - Date getMonth() return 11 
Javascript :: JS Recursive getLength of Array 
Javascript :: how to add jquery.zoom in angular 
Javascript :: jquery split multidimensional array 
Javascript :: 11 connection listeners added to [Namespace]. Use emitter.setMaxListeners() to increase limit 
Javascript :: update mongoose 
Javascript :: getIdfrommodelOnClickAjax 
Javascript :: reading data from link in javascript 
Javascript :: Install Date-Time in express.js 
Javascript :: js merge 2 index declarations for loop 
Javascript :: android MediaController audio example 
Javascript :: conditionally add property to JSON object javascript es6 
Javascript :: how to trigger on Blur only when clicked outside parent component and not child component in react js 
Javascript :: GetValueWithDataAttr 
Javascript :: modal in react 
Javascript :: php vscode editor.rulers vetical line delimiter line 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =