switch(tagName){
case "span":
node = element.parent().parent();
element = element;
break;
case "td":
node = element.parent();
element = element .find("span");
break;
default:
node = element;
break;
}
The above statement is equivalent to
if(tagName == " span"){
node = element.parent().parent();
element = element;
}else if(tagName == "td"){
node = element.parent( );
element = element.find("span");
}else{
node = element;
}
After paying attention to each case, be sure to Add: break;
default, which is equivalent to else
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn