Is there a way to "process" jquery code back into the html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

Is there a way to "process" jquery code back into the html?

If jquery is used to update, or correct html, would a programmer occasionally want to put the jquery coded data in place of the old or incorrect data in the html? In the last example, the sololearn.com link appears in the html, but the jquery instructions replace it with a link to jquery.com instead. If I want the html to be altered, removing all mention of sololearn.com, instead showing jquery.com in the html, and then remove the javascript jquery instruction, is there a way or reason to achieve this?

21st Aug 2017, 9:37 PM
James Boblak
James Boblak - avatar
2 Answers
+ 2
You can rewrite substring per substring sololearn.com for jquery.com, then place a cookie or something of that kind to retain that configuration. There's a way to remove the function, but no reasons to do it. Make another function where you treat the js as plain text and replace the function with "". If you want to have jquery.com in your site instead sololearn.com, why would you replace everything to begin with? I assume that's the idea because of that weird need of deleting the function. Oh, the changes will be on the client. You need a server script to rewrite the actual function to nothing.
9th Sep 2017, 1:54 AM
myenemy
+ 1
You can use the .text() Element. Basically, You could refer to the Element in HTML you want example : <h2 id=“showtext”></h2> After that in jQuery you could do, $(“#showtext”).text(“Hello There User!”) The String inside the text parmiters is what is put in the h2 tag which shows to the output, you could also enter variable in there Var Name = “Jack” $(“#showtext”).text(“Hello “ + Name) And that would print out Hello Jack in h2 form
26th Mar 2018, 1:59 AM
AClue
AClue - avatar