开发者

Found the type of element selected by getSelection

开发者 https://www.devze.com 2023-02-26 09:09 出处:网络
I need to know the type of item selected by getSelection: Sel:=ContentWindow.GetSelection; Range:=Sel.GetRangeAt(0); // le premier élément selectioné

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

精彩评论

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