|
|
Object which serves as the parameter to the function calls are constructed before you make the call. So you must have an appropriate "this" before you use it. see the example:- $(".edit").editInPlace({
- url: "./server.php",
- params: "folder=" + $(this).attr('folder')
- //show_buttons: true
- //$('.edit').attr('folder')
- });
复制代码 with the html is as follows:- <span class="edit" folder="folderName">text to edit</span>
复制代码
Won't fire the code as expected. data "folderName" will not pass to the parameter: you don't have an appropriate "this".
.attr("folder") will work fine, as you could test by, say,- $(".edit").click(function(evt) {
- alert($(this).attr("folder"));
- });
复制代码
Something like this might help restore "this" context:- $(".edit").each(function() {
- // now "this" is your HTML element
- $(this).editInPlace({
- url: "./server.php",
- params: "folder=" + $(this).attr('folder')
- // ...
- });
- });
复制代码
|
|