开发者

Allow User to Change Text By Clicking Word

开发者 https://www.devze.com 2023-02-22 10:41 出处:网络
I\'m trying to use PHP to display a short paragraph of text in which each word can be potentially clicked and changed by the user.

I'm trying to use PHP to display a short paragraph of text in which each word can be potentially clicked and changed by the user.

Fo开发者_运维知识库r example: "The quick brown fox jumps over the lazy dog." The user could click on "jumps" and change it to "walks", either via a popup window form or a menu that appears.

I'd like to use a database to keep track of the changes and maybe display the text in its past iterations in some way, too. I am kind of a novice, so don't be afraid to be specific.

Thanks!


HTML5-capable browsers can do this by default with proper use of contenteditable attribute. If you'd like to be backwards-compatible, you'll need to search for some kind of inline-editing (jQuery) plugin.

Btw at first this has nothing to do with PHP, databases because the user interaction happens at the client side natively with HTML5 or with JavaScript as a fallback. Of course, when editing done, you may want to store the submitted data in a database with the help of PHP.

0

精彩评论

暂无评论...
验证码 换一张
取 消