JS JQuery常用語法

2021-06-22 13:29:32 字數 1164 閱讀 8647

1. select元素

1.1獲取select選中的value和text值abc

$("#select1 option:selected").val(); 

or $("select1").find("option:selected").val();

$("select1 option:selected").text();

or $("select1").find("option:selected").text();

1.2.為select設定選中

設定option value為2的項選中

var s='2';

$("#select1").val(s); //ie8 firefox29有效

設定option text為c的項選中

$("#select1").find("option[text='c']").attr("selected",true); //ie firefox測試無效

2.checkbox元素

選項

2.1 checkbox檢查是否勾選

if($("#chk1").attr("checked")=='checked')else

2.2 設定checkbox選中

$("#chk1").attr("checked",true);

2.3 設定不選中

$("#chk1").removeattr("checked");

2.4 設定checkbox不可編輯

or

$("#chk1").attr("disabled","disabled");

去除不可編輯

$("#chk1").removeattr("disabled");

mysql常用語法 MySQL常用語法

更新資料 update 表名 set 健名 更改的值 where 建 刪除資料 delete from 表名 where 索引 create index 索引名稱 on 表名 鍵名 建立試圖 create view 檢視名 鍵,鍵 as select matchno,abs won lost fro...

mysql基本常用語法 mysql 常用語法

1.1.開啟 service mysql start 1.2.關閉 service mysql stop 1.3.重啟 service mysql restart 2.1.密碼明文 語法 mysql u使用者名稱 p使用者密碼 舉例 mysql uroot p123456 2.2.密碼密文 語法 m...

wiki常用語法

公司啟用了streber執行部分專案管理工作。streber基於wiki系統建立。在streber中,我們可以建立專案 project 可以為專案建立milestone task等等。與其他專案管理系統一樣,可以為每乙個task分配資源,指定執行時間。由於streber基於wiki組建,具備了wik...