Disable on Quick Edit/Bulk Edit but not on Textarea
-
Hi,
I’m currently creating a website with a custom post type and custom taxonomies / custom meta fields for this post type. As part of this development I have also modified the viewable columns on this custom post type’s list view page as well as the Quick Edit/Bulk Edit screen.
Everything is working perfectly except for one seemingly simply and annoying problem. On the Quick Edit/Bulk Edit screen I have textarea field that will allow the user to fill in multiple “values” for that field. The user would do this by pressing enter to create a new line in between each value in the textarea. The problem is that when enter is pressed in the textarea, the Quick Edit/Bulk Edit form is submitted.
I’ve tried to disable this behavior with JS by doing the following:
$('textarea').keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
var s = $(this).val();
$(this).val(s+"\n");
}
});
Unfortunately the above code doesn’t work. I’ve used it before on other projects but in this case it is not working. Pressing <enter> in the textarea still submits the form. I have considered using a function like pressing SHIFT+TAB together to add a new line in the textarea but that just seem counter-intuitive.
Any ideas?
- The topic ‘Disable on Quick Edit/Bulk Edit but not on Textarea’ is closed to new replies.