How to Determine if an Element Exists with jQuery?
jQuery makes it easy to determine if an element in your DOM exists.
if ( $('#elementID').length )
{
// do something
}
Simple enough, right?
2 notes / Permalink
jQuery makes it easy to determine if an element in your DOM exists.
if ( $('#elementID').length )
{
// do something
}
Simple enough, right?
2 notes / Permalink
To see if an element exists in jQuery you simply need to check for a length
$("#myElement").length
If the above ID has a length the statement returns true.
Tested in jQuery v1.4.2
1 note / Permalink
While doing some recent ASP.Net development I needed to use a Server Side Include (SSI) in a few pages of the site. Those familiar with ASP.Net might stop right here and say, “Just use the Master Page file.” Well the Master Page option wouldn’t work for the solution I needed.
I discovered that ASP.Net differs from ASP, PHP, or even SHTML in the fact that you can’t include a file with the traditional include statement: <!--#include file="include/file.txt" -->. So after a touch of research I uncovered the ASP.Net alternative to the “include” option.
<% Response.WriteFile(“files/name.txt”); %>
This method will write the file from the path in the rendered HTML of the page. A handy little tool to keep in the repertoire.
0 notes / Permalink