How to remove a HTML element from thymeleaf fragments page using jQuery?java - Showing the logout button only to logged usersHow do I detect a click outside an element?How do I check if an element is hidden in jQuery?How can I know which radio button is selected via jQuery?Creating a div element in jQueryHow to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?How to move an element into another element?How can I refresh a page with jQuery?Redirect from an HTML pagejQuery scroll to element

What to do when you reach a conclusion and find out later on that someone else already did?

Explanation for a joke about a three-legged dog that walks into a bar

Film where a boy turns into a princess

Why did modems have speakers?

How to handle aversion that derives from perceiving arrogance?

What are the exact meanings of roll, pitch and yaw?

Can I paint a load center cover?

Is the apartment I want to rent a scam?

What exactly makes a General Products hull nearly indestructible?

Where to place an artificial gland in the human body?

How can I prevent corporations from growing their own workforce?

Is Grandpa Irrational? Another Grandpa Mystery

Is the 2-Category of groupoids locally presentable?

kids pooling money for Lego League and taxes

High income, sudden windfall

Keeping an "hot eyeball planet" wet

What do I do when a student working in my lab "ghosts" me?

How did C64 games handle music during gameplay?

What is the purpose of this "red room" in Stranger Things?

401(k) investment after being fired. Do I own it?

Why did Saturn V not head straight to the moon?

How can I tell if there was a power cut while I was out?

Should I describe a character deeply before killing it?

Impact of throwing away fruit waste on a peak > 3200 m above a glacier



How to remove a HTML element from thymeleaf fragments page using jQuery?


java - Showing the logout button only to logged usersHow do I detect a click outside an element?How do I check if an element is hidden in jQuery?How can I know which radio button is selected via jQuery?Creating a div element in jQueryHow to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?How to move an element into another element?How can I refresh a page with jQuery?Redirect from an HTML pagejQuery scroll to element






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am working with spring boot and thymeleaf .I want to remove an element from framgments page so it should be removed from all pages which use that particular fragment.



<header th:fragment="userHeader">
<a href="login" id="login-ref" class="text-left">Login </a>
<a href="#" id="logout-ref" class="text-left">Log out</a>
</header>


The above code is my header which is in fragments page and i insert that in every page so after the user logs in the login ref should be hide.



And the following is jquery code.



submitHandler : function() 
var userData =
email : $("#email").val(),
password : $("#password").val()
;
$.ajax(
type: "POST",
contentType : 'application/json',
url : "/user/login",
data : JSON.stringify(userData),
dataType :'json',
success : function(result)
if(result.status)
$("#login-ref").hide();

,
error : function()
alert("Error! please enter proper data");


);
return false;



Looking forward for your help please.










share|improve this question



















  • 1





    Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

    – Pete
    Mar 26 at 15:57












  • what are you trying to do here ?

    – want2learn
    Mar 26 at 18:08











  • Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

    – g00glen00b
    Mar 27 at 6:59











  • Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

    – Merwais Muafaq
    Mar 27 at 16:04


















0















I am working with spring boot and thymeleaf .I want to remove an element from framgments page so it should be removed from all pages which use that particular fragment.



<header th:fragment="userHeader">
<a href="login" id="login-ref" class="text-left">Login </a>
<a href="#" id="logout-ref" class="text-left">Log out</a>
</header>


The above code is my header which is in fragments page and i insert that in every page so after the user logs in the login ref should be hide.



And the following is jquery code.



submitHandler : function() 
var userData =
email : $("#email").val(),
password : $("#password").val()
;
$.ajax(
type: "POST",
contentType : 'application/json',
url : "/user/login",
data : JSON.stringify(userData),
dataType :'json',
success : function(result)
if(result.status)
$("#login-ref").hide();

,
error : function()
alert("Error! please enter proper data");


);
return false;



Looking forward for your help please.










share|improve this question



















  • 1





    Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

    – Pete
    Mar 26 at 15:57












  • what are you trying to do here ?

    – want2learn
    Mar 26 at 18:08











  • Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

    – g00glen00b
    Mar 27 at 6:59











  • Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

    – Merwais Muafaq
    Mar 27 at 16:04














0












0








0








I am working with spring boot and thymeleaf .I want to remove an element from framgments page so it should be removed from all pages which use that particular fragment.



<header th:fragment="userHeader">
<a href="login" id="login-ref" class="text-left">Login </a>
<a href="#" id="logout-ref" class="text-left">Log out</a>
</header>


The above code is my header which is in fragments page and i insert that in every page so after the user logs in the login ref should be hide.



And the following is jquery code.



submitHandler : function() 
var userData =
email : $("#email").val(),
password : $("#password").val()
;
$.ajax(
type: "POST",
contentType : 'application/json',
url : "/user/login",
data : JSON.stringify(userData),
dataType :'json',
success : function(result)
if(result.status)
$("#login-ref").hide();

,
error : function()
alert("Error! please enter proper data");


);
return false;



Looking forward for your help please.










share|improve this question
















I am working with spring boot and thymeleaf .I want to remove an element from framgments page so it should be removed from all pages which use that particular fragment.



<header th:fragment="userHeader">
<a href="login" id="login-ref" class="text-left">Login </a>
<a href="#" id="logout-ref" class="text-left">Log out</a>
</header>


The above code is my header which is in fragments page and i insert that in every page so after the user logs in the login ref should be hide.



And the following is jquery code.



submitHandler : function() 
var userData =
email : $("#email").val(),
password : $("#password").val()
;
$.ajax(
type: "POST",
contentType : 'application/json',
url : "/user/login",
data : JSON.stringify(userData),
dataType :'json',
success : function(result)
if(result.status)
$("#login-ref").hide();

,
error : function()
alert("Error! please enter proper data");


);
return false;



Looking forward for your help please.







jquery html spring-boot thymeleaf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 18:22









chazsolo

5,5471 gold badge12 silver badges34 bronze badges




5,5471 gold badge12 silver badges34 bronze badges










asked Mar 26 at 15:49









Merwais MuafaqMerwais Muafaq

61 bronze badge




61 bronze badge







  • 1





    Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

    – Pete
    Mar 26 at 15:57












  • what are you trying to do here ?

    – want2learn
    Mar 26 at 18:08











  • Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

    – g00glen00b
    Mar 27 at 6:59











  • Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

    – Merwais Muafaq
    Mar 27 at 16:04













  • 1





    Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

    – Pete
    Mar 26 at 15:57












  • what are you trying to do here ?

    – want2learn
    Mar 26 at 18:08











  • Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

    – g00glen00b
    Mar 27 at 6:59











  • Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

    – Merwais Muafaq
    Mar 27 at 16:04








1




1





Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

– Pete
Mar 26 at 15:57






Hi and welcome to SO. It is expected you do a little research before posting a question. Using the first four words of your title in a search engine will help to give you ideas to get started or if it's more thmeleaf based , have a look for removing fragments from thmeleaf. Have a go at doing something and if you get stuck with a particular piece of code, then come back with a more specific question. As it stands, your question is too broad and therefore off topic for SO. may be helpful

– Pete
Mar 26 at 15:57














what are you trying to do here ?

– want2learn
Mar 26 at 18:08





what are you trying to do here ?

– want2learn
Mar 26 at 18:08













Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

– g00glen00b
Mar 27 at 6:59





Since you already have a $("#login-ref").hide(), what exactly is your question? Does this approach not work for you?

– g00glen00b
Mar 27 at 6:59













Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

– Merwais Muafaq
Mar 27 at 16:04






Iam using userHeader fragment of thymeleaf in all user panel pages once user logs in #login-ref should be hidden from all pages I used jQuery hide() method but it dint work.

– Merwais Muafaq
Mar 27 at 16:04













0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361269%2fhow-to-remove-a-html-element-from-thymeleaf-fragments-page-using-jquery%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361269%2fhow-to-remove-a-html-element-from-thymeleaf-fragments-page-using-jquery%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript