JQuery implementation code for obtaining all form values [not supported by IE] _ jquery

Source: Internet
Author: User
Get all form values through jquery, which is generally processed in the background language. This is obtained through jquery. It is a good idea that IE does not support it for the moment.
CSS:

The Code is as follows:




JS:

The Code is as follows:


Function form (){
$ ('# Myform'). submit (function (){
// Get text value
Var TV = $ ("# mytxt"). val (),
Tf = $ (this). find (": input [type = 'text']"). val (),
Tn = $ (this). find (": input [name = 'txtname']"). val ();
$ ("# Result1"). text (TV );
/* $ ("# Result1"). append ("You can get the value of text use these methods below:
"
+""+ TV +""+"
"
+"

"+ '$ (" # Mytxt "). val ()' +"
"
+ '$ (This). find (": input [type = \ 'text \']"). val () '+"
"
+ '$ (This). find (": input [name = \ 'txtname \']"). val () '+"
"
+"

");
*/
// $ ("# Result1"). delay (30000). fadeOut ();
// TV. attr (value, ''); clean value
// Get textarea value
Var av = $ ("# myarea"). val ();
$ ("# Result2"). text (av );
/* $ ("# Result2"). append ("You can get the value of textarea use these methods below:
"
+" "+ Av +""+"
"
+'

$ ("# Myarea"). val ()'
+"

");
*/
// $ ("# Result2"). delay (30000). fadeOut ();
Var str = "";
/* $ ("Select"). change (function (){
$ ("Select option: selected"). each (function (){
Str + = $ (this). val ();
});
$ ("# Result3"). text (str );
})
. Trigger ('change ');
*/
// $ ("Select [name = 'garden '] option: selected") if we have multiple select
$ ("Select [id = 'mysel '] option: selected"). each (function (){
Str = $ (this). val ();
});
$ ("# Result3"). text (str );
Var str2 = "";
$ ("Select [id = 'selecel'] option: selected"). each (function (){
Str2 + = $ (this). val () + "";
});
$ ("# Result4"). text (str2 );
Var str3 = [];
$ ("Input [name = 'checkme']: checked"). each (function (){
Str3.push ($ (this). val ());
});
Var oa = "";
$. Each (str3, function (key, val ){
Oa + = key + ":" + val;
});
$ ("# Result5"). text (oa );
Var ck = $ ("input [type = 'Radio ']: checked"). val ();
$ ("# Result6" 2.16.html (ck + "is checked! ");
Return false;
});
}
Form ();


HTML:

The Code is as follows:




Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.