jquery常用操作

2021-05-21 18:00:54 字數 451 閱讀 7988

操作下拉列表

新增選項列表

$(this).get(0).options.add(new option(text,value));

清空列表

$(this).get(0).options.length=0;

刪除指定索引的選項

$(this).get(0).remove(index);

設定需要選中項的值

$(this).get(0).value=value;

獲取當前選中選項的文字

$(this).get(0).options[index].text;

批量修改css

$(this).css()

使指定區域內的元素不可使用(變灰)

$(this).find(*).each(function(){$(this).attr("disabled",true);

JQuery常用操作

遍歷option和新增 移除option function changeshipmethod shipping else 取得下拉列表的選取值 testselect option selected text 或 testselect find option selected text 或 tests...

常用Jquery操作總結

核取方塊操作 需要代買蔬菜 需要清洗餐具 1 改變選中checkbox時執行 checkbox id change function checkbox id click function 2 迴圈取所有的checkbox的值 input name checkbox id checked each f...

jquery常用的操作

1.獲取內容的dom 2.往body新增 刪除 設定元素 prepend 在被選元素的裡面的前面插入內容 after 在被選元素的外面的後面插入內容 before 在被選元素外面的前面插入內容 設定多個屬性值如下 json格式 attr 3.獲取動態頁面的元素 selector on events,...