<button> <script> getSelfParent().click(function(){...}); </script> </button>
$(this).parent()不起作用.
编辑:
我想避免:
>在任何地方添加ID>每次我寻找自我元素时遍历整棵树
@Jakub M: this is the way I want to create buttons in my PHP.
尝试生成HTML | SCRIPT输出为:
<button> <script id='RandomOrUniqueIdValue'> var script=document.getElementById('RandomOrUniqueIdValue'); // var script=$('#RandomOrUniqueIdValue'); </script> </button>