获取参考脚本的父元素 [英] Obtaining a Reference do the Script's Parent Element
本文介绍了获取参考脚本的父元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用AJAX返回包含脚本的响应。
I am using AJAX to return a response which includes a script.
通过该脚本,我如何确定脚本运行的父元素的ID没有传递id到服务器?有没有办法?
Through that script, how can I determine the ID of the parent element the script is running in without passing id's to the server? Is there a way?
谢谢。
推荐答案
脚本的ID(将在古老浏览器中爆炸),您可以尝试:
If you assign an ID to the script (which will explode in ancient browsers), you can try:
var id = $("#idOfTheScript").parent()[0].id;
这篇关于获取参考脚本的父元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文