No products in the cart.
- This topic is empty.
-
AuthorPosts
-
July 9, 2015 at 2:00 am #9364
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterThis work for me:
$("#city :selected").text();I’m using jQuery 1.10.2
September 17, 2015 at 5:13 am #9365
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
Keymasterthe following worked for me:
$.trim($('#dropdownId option:selected').html())November 19, 2015 at 5:36 am #9369
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterSelect Text and selected value on dropdown/select change event in jQuery
$("#yourdropdownid").change(function() { console.log($("option:selected", this).text()); //text console.log($(this).val()); //value })January 23, 2016 at 9:07 am #9370
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterFor getting selected value use
$('#dropDownId').val();and for getting selected item text use this line:
$("#dropDownId option:selected").text();August 9, 2016 at 5:01 am #9361
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
Keymaster$(function () { alert('.val() = ' + $('#selectnumber').val() + ' AND html() = ' + $('#selectnumber option:selected').html() + ' AND .text() = ' + $('#selectnumber option:selected').text()); });<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <select id="selectnumber"> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> </select> </div> </form> </body> </html>January 4, 2017 at 12:53 pm #9367
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
Keymastervar e = document.getElementById("dropDownId"); var div = e.options[e.selectedIndex].text;January 18, 2017 at 9:56 am #9359
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterIf you want the result as a list, then use:
x=[]; $("#list_id").children(':selected').each(function(){x.push($(this).text());})March 9, 2017 at 7:03 am #9371
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterTry:
$var = jQuery("#dropdownid option:selected").val(); alert ($var);Or to get the text of the option, use
text():$var = jQuery("#dropdownid option:selected").text(); alert ($var);More Info:
March 15, 2018 at 10:21 am #9358
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterFor multi-selects:
$("#yourdropdownid :selected").map(function(i, v) { return $.trim($(v).text()); }May 21, 2018 at 11:01 am #9360
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
Keymaster$("#dropdownid option:selected").text();if you use asp.net and write
<Asp:dropdownlist id="ddl" runat="Server" />then you should use
$('#<%=ddl.Clientid%> option:selected').text();November 13, 2018 at 6:03 am #9372
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterSimply try the following code.
var text= $('#yourslectbox').find(":selected").text();it returns the text of the selected option.
January 12, 2019 at 11:12 am #9357
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterJust add the below line
$(this).prop('selected', true);replaced .att to .prop it worked for all browsers.
December 17, 2019 at 6:50 am #9373
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
Keymaster$("#dropdown").find(":selected").text(); $("#dropdown :selected").text();$("#dropdown option:selected").text();$("#dropdown").children(":selected").text();January 17, 2020 at 5:10 am #9362
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterTry
dropdown.selectedOptions[0].textfunction read() { console.log( dropdown.selectedOptions[0].text ); }<select id="dropdown"> <option value="1">First</option> <option value="2">Second</option> </select> <button onclick="read()">read</button>February 13, 2020 at 4:17 am #9376
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/u337135316/domains/bzotech.com/public_html/wp-includes/functions.php on line 6131
David Hoang
KeymasterThis code worked for me.
$("#yourdropdownid").children("option").filter(":selected").text(); -
AuthorPosts
- You must be logged in to reply to this topic.
