how to check whether the span element present or not
开发者_如何转开发I want to know the method to check if there is span element present or not.. if so that element should remove and add new span element... if there is no span element, then add the span element now... not only for span tell me the method which is applicable to all the situations or elements
Thank you
if($('#id').length)
// tells you whether it exists or not
based on you can write your logic
if ($('#my-element').length) {
// #my-element exists
}
use jquery's .remove()//or .hide()
精彩评论