ICT Department
asked on
How to toggle the placeholder of a textarea element in jquery?
Hi,
I have a good working function:
$("#TogglePat").click(func tion(){
$("#PatIcon").toggleClass( "fa-toggle -off fa-toggle-on",1000);
$(".PatField").toggle("slo w");
$("#ssBezorgadres option[value='Patiënt']"). prop('disa bled',func tion(i,v){ return!v;} );
};
I have a textarea element with a placeholder in place, on click of the above function I want the content of the placeholder to change (need to remove a bit if tekst) and be placed back when I click it again.
Hoe do I do this?
I have a good working function:
$("#TogglePat").click(func
$("#PatIcon").toggleClass(
$(".PatField").toggle("slo
$("#ssBezorgadres option[value='Patiënt']").
};
I have a textarea element with a placeholder in place, on click of the above function I want the content of the placeholder to change (need to remove a bit if tekst) and be placed back when I click it again.
Hoe do I do this?
ASKER
I will check this...
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
$('#myTextArea').prop('pla
To toggle it you'd need to know the 2 values, and how you do this would depend on your requirements. You'd also need to decide on what constitutes a toggle (on/off state). You're toggling a class on PatIcon, so you could potentially check if that element has a class and go from there. Here a very simple example
Open in new window