這一套也free的,也有結合contextMenu,最重要的是,官方網站有詳細的教學,個人感覺比jstree更好上手。目前發現一個小缺點,在新增節點時,無法在節點上輸入名稱,還是可以用,跳一個對話框出來輸入節點名稱來解決。
官方網站:Dynatree
下面將會整理一些常用的功能,來做為範例。
2011年6月8日 星期三
2011年5月17日 星期二
2009年8月4日 星期二
Jquery基本用法
取的文字方塊(text)中的值
有三種方式分別為
checkbox取得有勾選的值
$('input[name=checkBoxName]:checked').each(function(){
alert($(this).val());
});
radio取得有勾選的值
$('input[name=radioName]:checked').val();
radio預設勾選
$('input[value=2]:radio').attr('checked', 'checked');
或是
$('input[value=2][name=radioName]').attr('checked', 'checked');
判斷指定元素是否存在
if($('#testId').length > 0){
//to do
}
<input id="testId" class="testClass" value="123" name="test">
有三種方式分別為
- 用name取值 $("[name='test']").val() ;
- 用id取值 $("#testId").val();
- 用class取值 $(".testClass").val();
checkbox取得有勾選的值
$('input[name=checkBoxName]:checked').each(function(){
alert($(this).val());
});
radio取得有勾選的值
$('input[name=radioName]:checked').val();
radio預設勾選
$('input[value=2]:radio').attr('checked', 'checked');
或是
$('input[value=2][name=radioName]').attr('checked', 'checked');
判斷指定元素是否存在
if($('#testId').length > 0){
//to do
}
訂閱:
文章 (Atom)