javascript - Find if selector exists in variable -


how find out if data retreived .get() request contains html selector?

 $.get(url,function(data){   alert( data.find("#myid").length )  }); 

doesn't seem work.

supposing data html, use

$(data).find("#myid").length 

or more reliable solution if document isn't formed :

$("<div>").html(data).find("#myid") 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -