Search code examples
jqueryasp.net-mvcjeditable

how do you pass in a selector into jquery editable plugin


i am trying to pass in a selector into the ID variable but this doesn't seem to work as it blows up at runtime.

what is wrong with the below syntax ?

<script type="text/javascript">
    $(document).ready(function() {

    $(".dblclick").editable('<%=Url.Action("UpdateSettings","Photos", new { id = $(this).attr("id") }) %>', {
            tooltip: "Doubleclick to edit...",
            event: "dblclick",
            style: 'display: inline; width:400px;'
        });

    });


Solution

  • Have you tried

    <script type="text/javascript">
        $(document).ready(function() {
        var updateSettingsAction = '<%=Url.Action("UpdateSettings","Photos") %>';
        $(".dblclick").editable(updateSettingsAction + '/?id=' + $(this).attr("id"), {
                tooltip: "Doubleclick to edit...",
                event: "dblclick",
                style: 'display: inline; width:400px;'
            });
    
        });