Jump to content

Recommended Posts

I am not entirely sure what this is called, but say for example you have some text on a site, and you want to edit it right there and then, and you just click on the text, and it changes to a text field and you edit the text, then onblur it updates the text with the new content form the text field.

 

What is this called, and what is the best and easiest method of doing it?

Link to comment
https://forums.phpfreaks.com/topic/275989-onclick-edit/
Share on other sites

I am not entirely sure what this is called, but say for example you have some text on a site, and you want to edit it right there and then, and you just click on the text, and it changes to a text field and you edit the text, then onblur it updates the text with the new content form the text field.

 

What is this called, and what is the best and easiest method of doing it?

 

Best way to do it... There are lots of methods for achieving this but all depends on how complex you want to make it. If you need the fields to be draggable or sortable then you may opt for a different option but what follows is a simple example to highlight how easy it is.

 

Just as a quick illustration (and i am typing this directly in so sry if it doesn't work)

 

<form>

Country: 
<input type="text" name="someField"  value="WHATEVER"  
onblur="this.style.border='0px'; setAttribute('readonly','true')" 
onfocus="this.style.border='1px solid black'; removeAttribute('readonly','0')">
</form>
Edited by Drongo_III
Link to comment
https://forums.phpfreaks.com/topic/275989-onclick-edit/#findComment-1420226
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.