For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Friday, November 07, 2014

get selected text of select from jquery

Problem:
How to get selected text of select from jquery?

While working in web programming sometime you need to get text from select box or combobox along with it's value.

Solution:
You will use .val() method to get value and use .text() method to get text from select box or combo box in jquery.



Example:
Use listed below code:
To get value:
var myval=$("#myselect").val();

To get Text:
var mytxt=$("#myselect :selected").text();
Share:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive