簡體   English   中英

如何在php(jquery plugin)中向樹視圖添加onclick事件?

[英]How to add onclick event to treeview in php(jquery plugin)?

我已經在php中實現了異步樹視圖 ,現在我想在樹視圖中的項目上添加onclick事件,然后在mysql中進行查詢。

你知道怎么做嗎?

非常感謝。

編輯:

Async.html:

<script type="text/javascript">
$(document).ready(function(){
    $("#black").treeview({
        url: "twodimen.php"
    });
    $("#black > li").live("click",function()){
        $.get("");
    })
});
</script>

<ul id="black">
</ul>

但是,當我添加$("#black > li").live("click", function()){} ,樹形視圖不會顯示。

怎么做?

好吧,這將是一個開始:

$("#treeview > li").click(function() { // this sets the onclick on your node
    $.get('url_to_php_script_that_will_the_db'); // this calls an url using GET.
    $.post('url_to_php_script_that_will_the_db'); // this calls an url using POST.
}

假設您的樹視圖的ID為“ treeview”,則樹視圖下的所有<li>都將具有click事件。 這是一個艱難的開始,但這基本上就是您要尋找的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM