I'm using the jEditable plugin and the following code to toggle between On and Off for a series of settings on a page.
$(document).ready(function() { $('.editable_select').editable(''http://someexamplepage.com/save.php', { indicator: '<img src="/images/spinner.gif">', data : " {'✓':'✓','✗':'✗'} ", tooltip : 'Click to Edit', type : 'select', onblur : 'submit', style : 'inherit' }); });
And then this in the html:
<b class="editable_select" id="setting1" style="display:inline">✓</b>
When the checkmark indicating On is clicked, it produces a dropdown menu with checkmark for On and the X for Off in it, which the user can then select. What I would prefer is that clicking the check/X not open a dropdown, but instead send the current On or Off setting to the save.php file. I could then just write the save.php file to return the opposite value, so that clicking just toggles between the two without opening any kind of edit window. I tried the following code:
$(document).ready(function() { $('.editable_select').editable('http://someexamplepage.com/save.php', { indicator: '<img src="/images/spinner.gif">', tooltip : 'Click to Edit', onclick : 'submit', style : 'inherit' });
});
But clicking the text still opens a little editing window, which I don't want. I'm still new to JavaScript and jQuery, so any help is greatly appreciated!