In table I have 1 column in which text-box is given so that user can edit text in that as per their need ,edited text is getting saved onkeyup properly but i want to hide text-box border ,or i can say after editing text text-box should not be visible ,only the edited text should be visible ,and if user again wants to edit than user should be able to see that text-box when user click on text again,something like this I want textbox effect like this,and i don’t want to use jquery,how can i do this
here is my code for textbox
echo "<td ><input id={remark{$j}} type=\"text\" onkeyup=\"writeremark(this.id,{$data_set1['eid']},{$emprid});\" value=\"{$data_set1['remark']}\" /></td>";
onkeyup function
function writeremark(e,eid,emprid) {
var val=document.getElementById(e).value;
var dataString = 'eid='+eid +'&emprid='+emprid +'&val='+val ;
$.ajax({
type:"POST",
url: "updateremark.php",
data: dataString,
success: function(result){
}
});
}
To Hide the Border you can use Javascript.
onblurevent is what you need, onblur means when you remove focus from this input, either by clicking outside of it, or by pressing TAB to give focus to another element.Then when the user clicks back on it, you can use
onfocus.UPDATE
As Fiona T suggested, you can do this in CSS (better solution).
Give your input a class.
Then in CSS:
However, I suggest that you don’t hide and show the border, because the size of the input may vary, you are technically removing the border which would be 1px,2px,3px…
So change the color instead of that, if your background is white, then…