This article mainly introduces the json file used in the Three-Level Association select using jquery. It is only an example. You can add or compile it as needed. For more information, see, I hope to help you with the html and js sections
The Code is as follows:
SelectList
The problem in IE8 is that selectedValuepost is directly sent to the background, and an error is reported when the background receives the message. This is because selectedValue in IE8 is used as an array and cannot be identified in the background when jquery is used to obtain the select statement, generally:
Var selectedValue = $ ("# a"). val ();
In non-IE8, the value of selectedValue is "1", and
Jquery implementation list (line by line color, select all, move the mouse over the current line). For more information, see [javascript].
The Code is as follows:
$ (Function (){Gridview ("GridView1 ");});// GridviewFunction gridview (objgridview ){// Get obj idVar gridviewId = "#" + objgridview;// Even$ (GridviewId + "> tbody tr: even"). addClass ("NormalColor ");// First$ (GridviewId + "> tbody tr: firs
Don't talk nonsense, directly on the codeImitation jquery Mobile Select control//Usage box for container id,_id accusation piece Id,selectvalue is the selected value, value is the current value function Selectbox (Box,_id,selectvalue, Value) {if (value! = Selectvalue) {$ ("#" + box). HTML ("How to use:
Here is the JS
Code :
Copy code The Code is as follows: jquery. FN. size = function ()
{
Return jquery (this). Get (0). Options. length;
}
// Obtain the index of the selected item
Jquery. FN. getselectedindex = function ()
{
Return jquery (this). Get (0). selectedindex;
}
// Obtain the text of the selected item
Jquery can actually operate the select form, but it does not. net controls are easy to operate. I went to Google for a while on the Internet and found a good plug-in for Special select operations. It is very good and I have used it. It feels pretty good. Here is the js Code:
The Code is as follows:
JQuery. fn. size
Share the Code with you:
JavaScript code
Copy codeThe Code is as follows: // obtain the number of select items
JQuery. fn. size = function ()
{
Return jQuery (this). get (0). options. length;
}
// Obtain the index of the selected item
JQuery. fn. getSelectedIndex = function ()
{
Return
Syntax Explanation:1. $ ("#select_id"). Change (function () {//code ...}); Adds an event for a select that fires when one of the items is selected2. Var checktext=$ ("#select_id"). Find ("option:selected"). Text (); Gets the text selected by select3. Var checkvalue=$ ("#select_id"). Val (); Gets the value of the Select selection4. Var checkindex=$ ("#select_id"). Get (0). SelectedIndex; Get the index value
The example in this article describes the way jquery adds, deletes, and modifies select option. Share to everyone for your reference, specific as follows:
jquery Gets the text and value selected by select:
1.
Gets the text
var checktext=jquery ("#select_id") sele
Jquery-selectors-lastchild Select the last child element
Selectors/lastchild
From jQuery JavaScript Library
: Last-child OverviewMatches all elements this are the last child of their parent. While:last matches only a single element, this matches the more then one:one for each parent.Demo Finds the last span in each matched div and adds some CSS plus a hover s
jquery Gets the text and value selected by select:Syntax Explanation:1. $ ("#select_id"). Change (function () {//code ...}); Add an event for Select, which is triggered when one of the items is selected2. Var checktext=$ ("#select_id"). Find ("option:selected"). Text (); Gets the text selected by the Select3. Var checkvalue=$ ("#select_id"). Val (); Gets the value selected by select4. Var checkindex=$ ("#se
The method for jquery to obtain the selected value of select is analyzed,
This example describes how jquery obtains the selected select value. We will share this with you for your reference. The details are as follows:
Misunderstanding:
Previously, I thought jquery would get
JQuery Gets the text and value:1. Var checktext=jquery ("#select_id") selected by select. Find ("option:selected"). Text (); Gets the Select selected text 2. var checkvalue=jquery ("#select_id"). Val (); Gets the Select Option V
// Obtain the number of select items
Jquery. FN. size = function (){
Return jquery (this). Get (0). Options. length;
}
// Obtain the index of the selected itemJquery. FN. getselectedindex = function (){Return jquery (this). Get (0). selectedindex;}
// Obtain the text of the selected itemJquery. FN. getselectedtex
This includes jquery. Gets the number of select items, the text of the selected item before the index the first item of the value text of the selected item is selected to delete operations such as the selected item in the Select.
Get the number of select itemsJquery.fn.size = function () {Return
It should be noted that the code here is a lot of the previous version of jquery 1.32 (a later version does not support @), so replace it with an empty test.
jquery Gets the text and value selected by select:Syntax Explanation:
1. $ ("#select_id"). Change (function () {//code ...}); Adds an event for a select that fires when one of the items is selected
2. Var
query Gets the text and Valu selected for select e: Syntax explanation: 1. $ ("#select_id"). Change (function () {//code ...}); //Add an event for SELECT, trigger when one of the items is selected, 2. Var checktext=$ ("#select_id"). Find ("option:selected"). Text (); //Get text of select selected, 3. Var checkvalue=$ ("#select_id"). Val ();//Get value selec
Here is the code for JS:
Copy Code code as follows:
JQuery.fn.size = function ()
{
Return JQuery (this). Get (0). Options.length;
}
Get the index of the selected item
JQuery.fn.getSelectedIndex = function ()
{
Return JQuery (this). Get (0). SelectedIndex;
}
Get the text of the currently selected item
JQuery.fn.getSelectedText = function ()
{
if (this.size () = = 0)
{
Return "No op
[Html] jQuery obtains the Text and Value selected by the Select statement. Syntax: 1. $ ( quot; # select_id quot ;). change (function () {// code ...}); // Add an event for the Select statement. This event is triggered when one of the Select statements is selected. varcheckText $ ( quot; # select_id quot;) [html]
Jquery obtains the text and value selected by the SELECT statement (jquery learning Memorandum)
Syntax explanation:1. $ ("# select_id"). Change (function () {// code...}); // Add an event for select, triggered when one of the select events is selected2. var checktext = $ ("
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.