Last active
May 11, 2020 14:15
-
-
Save juanmaioli/66b32b5c0abfc48cb4f91b0dbc5342f7 to your computer and use it in GitHub Desktop.
Edit input and style and href
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.inputSimple{ | |
border: none; | |
background-color: #fff; | |
color: #000; | |
} | |
.inputLinea{ | |
border: none; | |
background-color: #fff; | |
color: #000; | |
border: none; | |
border-bottom: 1px solid #28A745; | |
} | |
</style> | |
<input type="text" class="inputSimple" name="cli_company" id="cli_company" value="cli_company_value>" disabled> | |
<a href="javascript:editItem('cli_company');" id="cli_company_a"> | |
<i class="far fa-pen text-dark" name="cli_company_i" id="cli_company_i"></i> | |
</a> | |
<script> | |
function editItem(itemName){ | |
var editarHabiltado = document.getElementById(itemName); | |
var editarIcono = document.getElementById(itemName+'_i'); | |
var editarEnlace = document.getElementById(itemName+'_a'); | |
editarEnlace.href = "javascript:saveItem('cli_company');" | |
editarHabiltado.disabled = false; | |
editarHabiltado.classList.remove("inputSimple"); | |
editarHabiltado.classList.add("inputLinea"); | |
editarIcono.classList.remove("fa-pen"); | |
editarIcono.classList.add("fa-save"); | |
editarIcono.classList.remove("text-dark"); | |
editarIcono.classList.add("text-success"); | |
} | |
function saveItem(itemName){ | |
var editarHabiltado = document.getElementById(itemName); | |
var editarIcono = document.getElementById(itemName+'_i'); | |
var editarEnlace = document.getElementById(itemName+'_a'); | |
editarEnlace.href = "javascript:editItem('cli_company');" | |
editarHabiltado.disabled = true; | |
editarHabiltado.classList.remove("inputLinea"); | |
editarHabiltado.classList.add("inputSimple"); | |
editarIcono.classList.remove("fa-save"); | |
editarIcono.classList.add("fa-pen"); | |
editarIcono.classList.remove("text-success"); | |
editarIcono.classList.add("text-dark"); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment