Obtaining a Reference do the Script's Parent Element

前端 未结 1 1330
不思量自难忘°
不思量自难忘° 2021-01-22 09:47

I am using AJAX to return a response which includes a script.

Through that script, how can I determine the ID of the parent element the script is running in without pass

相关标签:
1条回答
  • 2021-01-22 10:19

    If you assign an ID to the script (which will explode in ancient browsers), you can try:

    var id = $("#idOfTheScript").parent()[0].id;
    
    0 讨论(0)
提交回复
热议问题