Jquery editable plugin code not working
The basic usage of the plugin looks simple but it does not work for me. I am using Firefox and Chrome.
html code:
<div class="editable"> limited to 200 char my private messages</div>
js code:
$('div.editable').cli开发者_如何学Pythonck(function() { $this.editable();});
When I click the text inside the div on my page, nothing happens.
I viewed my source code and both jquery and editable JavaScript files are there.
What's wrong with my code?
I believe you may want to call $('div.editable').editable()
immediately (or in $(document).ready()
) to mark the div
as editable. The handling of going into edit mode upon clicking the div
should be automatically done by the plugin.
Otherwise, after changing $this
to $(this)
you may have to click twice to enter edit mode for the first time. Or it might not work at all when repeatedly making the same element editable (which depends on how the plugin handles this scenario).
Try changing $this to $(this) - it needs to go through jQuery.
Use $(function(){ ...your code goes here... }). Which jquery plugin are you using for editable? inline editor or https://github.com/tectual/jQuery-Editable and as it is said use $(this)
精彩评论