PHP Code:
<li> <span class= "L2" > City </span> <select cl ass= "City" > <option value= "" > Selection of cities </option> <%foreach F rom= $supportcity item=city key=k%> <option value= "<% $k%>" <%if $nowcity = = $city. City
_name%>selected<%/if%> ><% $city .city_name%></option> <%/foreach%> </select> </li> <li> <span class= "L
2 "id=" area > Location </span> <%foreach from= $supportcity item=city key=k%>
<select class= "area" citycode= "<% $k%>" > <option value= "" > select Region </option> <%foreach from= $city. Areas item=area%> <option value= "<% $a Rea.area%> "><%$Area.area%></option> <%/foreach%> </select> <%/foreach%> </li>
jquery Code:
$ ("select.city"). Change (function () {
var Ccode = $ (this). Val ();
$ ("Select.area"). Hide ();
if (ccode) {
$ ("select.area[citycode=" +ccode+ "]"). Show ();
}
};
var sltcity = $ ("Select.city"). Val ();
if (sltcity) {
$ ("select.area[citycode=" +sltcity+ "]"). Show ();
The following are detailed:
jquery Radio value, checkbox value, select Value, Radio selected, CheckBox selected, select selected, and related settings
Gets the value of a set of radio selected items: var item = $ (' input[name=items][checked] '). Val ();
Gets the text of the Select selected item: var item = $ ("select[@name =items] option[@selected]"). Text ();
Gets the text of the Select selected item: var item = $ ("Select[name=items] option[selected]"). Text (); or $ ("Select[name=items]"). Find ("option:selected"). Text ();
The second element of the Select Drop-down box is the currently selected value: $ (' #select_id ') [0].selectedindex = 1;
Select Drop-down Box value = ' val ' element is currently selected: $ ("Select[name=items] option[value= ' val '"). attr ("Selected", "Selected");
The second element of the radio Radio Group is the current check: $ (' input[@name =items] '). Get (1). checked = true; or $ (' input[name=items] '). attr ("Checked", ' 1′);
The Radio value = ' val ' element is currently selected: $ (' input[name=items] [value= ' Val '] '). attr ("Checked", "checked");
Get Value:
text box, text area: $ ("#txt"). attr ("value");
Multiple-selection box checkbox:$ ("Input[name= ' checkbox ': Checked]"). each (function () {
var val = $ (this). Val ();
});
Radio Group Radio: $ ("input[type=radio][checked]"). Val ();
Value value of the dropdown box select: $ (' select '). val ();
Dropdown box Select the selected text value: $ ("select"). Find ("option:selected"). Text ();
Control form elements:
text box, text area: $ ("#txt"). attr ("value", "); Empty content
$ ("#txt"). attr ("value", ' 11′ '); Fill content
Multi-selection box checkbox:
The second element of the checkbox is ticked: $ ("Input[name=items]"). Get (1). checked = true; Tick mark
$ ("Input[name=items]"). Get (1). checked = false; No tick.
CheckBox's value= ' val ' element before tick: $ ("Input[name=item][value= ' Val ']"). attr ("Checked", true); or $ ("Input[name=item][value= ' Val ']"). attr ("Checked", "checked");
if ($ ("Input[name=item][value= ' Val ']"). attr (' checked ') ==true)//judge whether it has been ticked
Radio Group Radio: $ ("Input[type=radio]"). attr ("Checked", ' 2′);//Set value=2 project is currently selected
Dropdown box Select: $ ("#sel"). attr ("value", '-sel3′);//Set VALUE=-SEL3 item is currently selected
$ ("<option value= ' 1′>1111</option><option value= ' 2′>2222</option>"). AppendTo ("#sel")// Option to add a drop-down box
$ ("#sel"). empty ();//Empty Drop-down box
jquery Gets the value of the radio selection
Code
$ ("Input[name= ' Radio_name '][checked]"). Val (); Select the value of the selected radio
$ ("#text_id"). focus (function () {//code ...}); Event is triggered when object text_id gets focus
$ ("#text_id"). blur (function () {//code ...}); Event is triggered when the object text_id loses focus
$ ("#text_id"). Select (); Make the Vlaue value of the text box selected
$ ("Input[name= ' radio_name '][value= ' to select Radio Value '").
attr ("Checked", true); Set Radio as selected based on value values
jquery Gets the value value of the checkbox selection
$ ("Input[name= ' Checkbox_name '][checked]"); Select a collection of selected checkbox elements if you want the value, you need to traverse the collection.
$ ($ ("Input[name= ' Checkbox_name '][checked]")).
each (function () {arrchk+=this.value + ', ';}); /Traverse the collection of selected checkbox elements to get value
$ ("#checkbox_id"). attr ("checked"); Gets the state of a checkbox (has not been selected, returns True/false)
$ ("#checkbox_id"). attr ("Checked", true); Sets the status of a checkbox to be checked (checked=true)
$ ("#checkbox_id"). attr ("checked", false); Set the status of a checkbox to unchecked (Checked=false)
$ ("Input[name= ' Checkbox_name ']"). attr
("Checked", $ ("#checkbox_id"). attr ("checked");//According to the 3,4,5, you can analyze the meaning of this code.
$ ("#text_id"). Val (). Split (","); Returns the value of text to ', ' separated by an array
jquery1.3.2
Isdark: $ ("input[@type =radio][name=isdark][checked]"). Val ()
$ ("Input[name=radioname][value=radio value]"). attr ("Checked", "checked");