javascript tutorial - [Solved-5 Solutions] jQuery : get selected element tag name
- javascript - java script - javascript array
Problem:
Is there an easy way to get a tag name?
For example, if we are given $('a') into a function, We want to get 'a'.
Solution 1:
We can call .prop("tagName"). Examples:
If writing out .prop("tagName") is tedious, we can create a custom function like so:
Examples:
Note that tag names are, by convention, returned CAPITALIZED. If we want the returned tag name to be all lowercase, we can edit the custom function like so:
Related Searches to javascript tutorial - jQuery : get selected element tag name
get tag name javascriptjquery get tagname of clicked elementjquery element name selectorhow to find tag name in htmljquery next tag namejquery nodenamejquery get tag valuejquery prop tagnameget tag name javascriptjquery element name selectorjquery get element tag namejquery nodenamejquery get tag valueevent.target jqueryevent target idjquery get current element tagnamejavascript tutorialjava scriptjavascriptjavascript arrayjavascript booklearn javascriptjavascript codejavascript editorjavascript classjavascripjavascript debuggerjavascript onlinejavascript examplesjavascript testjavascript documentjavascript sliderwhat is javascriptjavascript form validationjavascript validatorhtml javascriptjavascript alertjavascript eventsjavascript printjavascript domjavascript objectjavascript functionhref javascriptjavascript datejavascript promptjavascript onclickjavascript returnjavascript forjavascript numberjavascript confirmjavascript onchangejavascript regular expressionjavascript ifjavascript variablejavascript timerjavascript cookiejavascript getelementbyidjavascript innerhtmljavascript calljavascript regexpjavascript includesjavascript thisjavascript eval