Jump to content

onclick edit


1internet

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>
Link to comment
https://forums.phpfreaks.com/topic/275989-onclick-edit/#findComment-1420226
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.