-1

私はここで親のIDを見つけることについて話している多くの記事を見つけました、そして私はそれらすべてを試しましたが成功しませんでした。

これが私のコードです:

<html>
<head>
<title>a</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-    ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<script type="text/javascript" src="http://www.appelsiini.net/download/jquery.jeditable.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.edit_area').editable('edit.php', { 
submitdata : {pid : $(this).parents('div:eq(0)').attr('id')},
//submitdata : {pid : $(this).closest("div").attr("id")},
//submitdata : {pid : $(this).parent().attr('id')},
//submitdata : {pid : this.parentNode.id},
//submitdata : {pid : $(this).parent().get(0).id},
//submitdata : {pid : $(this).parent()[0].id},

type      : 'textarea',
cancel    : 'Cancel',
submit    : 'OK',
//indicator : '<img src="img/indicator.gif">',
tooltip   : 'Click to edit...'
});
});
</script>
</head>
<body>
<div id="b112233">
<div class="edit_area" id="k123">hi</div>
</div>
</body>
</html>

ありがとうございました。

4

1 に答える 1

2

関数を使用して、追加のパラメーターを作成します。

submitdata : function() {
       return {pid:$(this).parent('div').attr('id')};
   }
于 2012-11-05T21:50:13.907 に答える