Ich möchte Funktion für beide hinzufügen und entfernen in einer einzigen Taste.HINZUFÜGEN und ENTFERNEN Knopf Funktion in jquery
Standard der innere Text ist nur nach einem Klick auf die Schaltfläche auswählen sollte es "Remove" ersetzt werden. Es sollte Toggle-Funktion wie sein. Bitte geben Sie an, wie Sie vorgehen können.
JQuery:
$('.lgi_btn_cta_toggle').on('click', function(){
$(this).html('Selected').attr('id', 'Ctabutton-selected').append("<span class='lgi_btn_cta_toggle-selected'></span>").addClass('tested').addClass('lgi_btn_cta_toggle-selected-hover');
});
HTML:
<a href="#" target="_top" class="lgi_btn_cta_toggle clearboth tested lgi_btn_cta_toggle-selected-hover" data-upc-tooltip-type="none" title="">Select<span class="lgi_btn_cta_toggle-selected"></span></a>
CSS:
.lgi_btn_cta_toggle {
font-size: 1.125rem;
line-height: 1.7rem;
height: 44px;
padding: 8px 46px;
}
.lgi_btn_cta_toggle > span:after {
font-size: 14px;
width: 13px !important;
height: 15px !important;
overflow: hidden;
}
.lgi_btn_cta_toggle {
color: #5a9996;
background-color: transparent;
border-width: 1px;
border-style: solid;
border-color: #5a9996;
}
.lgi_btn_cta_toggle.disabled,
.lgi_btn_cta_toggle[disabled] {
color: #c2c2c2;
background-color: transparent;
border-width: 1px;
border-style: solid;
border-color: #c2c2c2;
}
.lgi_btn_cta_toggle:hover,
.lgi_btn_cta_toggle:focus,
.lgi_btn_cta_toggle:active {
color: #5a9996;
background-color: transparent;
border-width: 3px;
border-style: solid;
border-color: #5a9996;
line-height: 23px;
padding: 8px 44px;
}
.lgi_btn_cta_toggle {
padding: 8px 46px;
}
.tested{
padding: 8px 54px 8px 15px !important;
}
.tested:hover{
padding: 8px 50px 8px 13px !important;
}
a span.lgi_btn_cta_toggle-selected {
min-width: 43px;
height: 45px!important;
background: #5a9996;
position: absolute;
margin-top: -10px;
margin-left: 13px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-top-right-radius: 18px;
border-bottom-right-radius: 18px;
padding-top: 10px !important;
}
a span.lgi_btn_cta_toggle-selected:focus, span.lgi_btn_cta_toggle-selected:active {
min-width: 43px;
height: 43px!important;
background: #5a9996;
position: absolute;
margin-top: -10px;
margin-left: 13px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-top-right-radius: 18px;
border-bottom-right-radius: 18px;
padding-top: 10px !important;
}
a span.lgi_btn_cta_toggle-selected-hover {
min-width: 43px;
height: 43px !important;
background: #5a9996;
position: absolute;
margin-top: -12px;
margin-left: 13px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-top-right-radius: 18px;
border-bottom-right-radius: 18px;
padding-top: 10px !important;
}
.lgi_btn_cta_toggle-selected:after {
font-family: "MaterialIcons";
content: "\e876";
color: #ffffff;
font-weight: bold;
}
.lgi_btn_cta_toggle > span:after {
font-size: 18px;
width: 13px !important;
height: 15px !important;
overflow: hidden;
}
Eigentlich haben Sie die Taste 'Auswahl' Text vor die Schaltfläche klicken. Wenn ich auf die Schaltfläche "Auswählen" klicke, sollte sie ausgewechselt werden und ich klicke erneut auf die Schaltfläche "Ausgewählt". Sie sollte auf der Schaltfläche "Entfernen" ersetzt werden. – jayrock
ok - ich verstehe - Sie möchten die Sequenz ausgewählt - ausgewählt - löschen ..... aber das ist anders als Sie in Ihrem Beitrag gefragt - Sie wollten zwischen auswählen und entfernen. was ist das, was ich zur Verfügung gestellt – gavgrif
Absolut korrekt, ich meine ähnlich Toggle-Funktion. Bitte beraten. – jayrock