KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
For example I want a function that is used by many elements to get the attributes of the calling element. function example(){ var name = //name of the calling element "$(this).attr('name')" } <button name="somename1" onclick="example()">Button1</button> <button name="somename2" onclick="example()">Button2</button> so if the button named 'somename1' calls the function, the variable 'name' will be assigned to 'somename1' and so if 'somename2' called it, it will be assigned to 'somename2'
Tags (comma-separated)
Save Edits
Cancel