开发者

Found the type of element selected by getSelection

I need to know the type of item selected by getSelection:

Sel:=ContentWindow.GetSelection;
  Range:=Sel.GetRangeAt(0); // le premier élément selectioné
   sel.RemoveAllRanges();
  range.deleteContent开发者_JS百科s();
  // obtenir l'alocation de la sélection courante
  Container:=Range.StartContainer;

> How to know that the selected object is an image or a table, or just a text link. because I need to extract all property of each selected object.


once you have the item you want, then you can use the localName property.

var temp = document.getElementById("someid");
console.log(temp.localName);

If the element with the id="someid" was a div, then the console would have "div" in it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜