how to know wether an element is exist in a html page.
来源:互联网 发布:编程做游戏 编辑:程序博客网 时间:2024/05/20 11:52
You should use jquery is() function to test
if($("#element_expr").is("element _type")){}
example:
add_Tree_Node: function(parentid, id, mytitle,clickcallback)
{
if(!$("#"+parentid+">ul").is("ul"))
{ // can not find
var ulhtml="<ul></ul>";
$("#"+parentid).append(ulhtml);
}
var childhtml=" <li id='"+id+"' class=/"folder userfolder last/"><span class=/"name/"><a class=/"move/" href='javascript:void(0)' onclick="+clickcallback+"(this,'"+id+"')>"+mytitle+"</a></span></li> ";
$("#"+parentid).find('li').each(function()
{
$(this).removeClass("last");
});
$("#"+parentid+">ul").append(childhtml);
},
if($("#element_expr").is("element _type")){}
example:
add_Tree_Node: function(parentid, id, mytitle,clickcallback)
{
if(!$("#"+parentid+">ul").is("ul"))
{ // can not find
var ulhtml="<ul></ul>";
$("#"+parentid).append(ulhtml);
}
var childhtml=" <li id='"+id+"' class=/"folder userfolder last/"><span class=/"name/"><a class=/"move/" href='javascript:void(0)' onclick="+clickcallback+"(this,'"+id+"')>"+mytitle+"</a></span></li> ";
$("#"+parentid).find('li').each(function()
{
$(this).removeClass("last");
});
$("#"+parentid+">ul").append(childhtml);
},
- how to know wether an element is exist in a html page.
- how to know whether an element has an class
- Show how to print a table in a html page
- How to know is the file exist in C++ - 在C++中如何判断文件是否存在
- How to know one virtual machine is in which host?
- how to know process is alive in linux?
- How to put a space character before option text in a HTML select element?
- How To Determine When a Page Is Done Loading in WebBrowser Control
- [morals is a way to success]How to know a float number is equal to another
- how to show html code in html page
- How to handle form events after adding a master page to an existing page
- What is global registry and how to know a repository is a global registry
- [lua] How do I know if a table is an array?
- How to save a web page as HTML or MHT
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- Judging wether a specific number is in the array using JavaScript
- How to freeze a dynamic aspx page into a static html page (on the server).
- How to freeze a dynamic aspx page into a static html page (on the server).
- 展示JDBC存取ORACLE大型数据对象CLOB几种情况的示范类
- 百度又神经了
- 计数器的 VHDL 程序
- 针对08年数学建模年D题一个算法的思考
- D触发器 的VHDL
- how to know wether an element is exist in a html page.
- WINDOWS2003进行WindowsFTP设置的一些注意事项
- CE驱动大全 一
- powerdesigner 显示 工具选项板 的菜单
- zz - DLL远程注入
- 中文输入法的添加
- 有关触发器 1
- C#中类的可访问修饰符
- SQL Server 2005 安装不了SP2的原因及解决办法