How Can I Run My Search Box Without JavaScript? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to remove JavaScript. But it does not work without JavaScript. What is the solution for this, please any modified code?

CSS is used to style the content and JS is the proper way to handle clicks and go some logic. Explain what you mean by damaging the system and I will try to help you fix it.

CSS means casacade style sheets, how do you want to create forms and functions with it? You definitely need js.
In other words, css is for the visuals, javascript to give it functionality. You just can't create methods using css.

CSS is for styling only (colours, font style etc.) as mentioned by others. Adding 'interactivity' by css would be somthing like this
.search-button a:active{background-color:#000;}
Change style on active or hover etc, but thats about it.
Personally I wouldn't say this is interactive. Javascript shouldn't slow down your website as its used by thousands of websites extensively eveyday. If it is then you need to take a look at the javascript code and debug it.
Regards

Related

Choosing between Javascript and CSS to handle user events [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I've been perusing the internet learning more advanced aspects of CSS, and with moderate knowledge of both languages I was able to quickly realize that CSS pseudo-classes are all capable of being performed through javascript event listeners. For example, Javascript has an onfocus event listener that allows you to make changes to controls based on whether or not the user has focused into a textbox, select control, etc. So it comes to a decision of whether it would be better to create a pseudo class in CSS to change the styling of the control, or use javascript to change the class/styling on these events.
My question is, is there a best-practice for this? or is this a situation where it's just best to remain consistent throughout your code but one way is not better than the other? Since Javascript is typically more bloated than CSS, would that make it slightly better to use CSS?
I would advice you to use CSS instead of Javascript for something simple as changing the styling of the focused element. If you insist on using javascript or if the context is appropriate. It is easier to read and maintain the code if you add/remove classes to change the styling.

What is the way to isolate HTML/CSS/Javascript without an iframe? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Suppose that I have a blob of HTML, CSS and JS that I wish to repeat on a page. Logically this blob of HTML/CSS/JS is a "control" and I wish to repeat this control on the page. Inside this HTML/CSS/JS blob are some IDs, such as tab1, tab2, and tab3 and the JS refers to tab1, tab2 and tab3 using jQuery.
Now of course this works fine when it is repeated only once. But in order to repeat it more than once and have it not break, I need to change the IDs to something like instance1_tab1, instance2_tab1, instance3_tab1 and so on and also change the Javascript as well.
Now of course I can do this but it feels painful.
So the question is - is there a modern way to simply isolate each of these repeats without using an iFrame?
Right now I am using iFrame to separate them and it is kind of gross so would like to make it better. Any help would be greatly appreciated.
Update: Edited to remove the word "best". It is not very helpful how the moderators are closing the question as "opinion based" when it is clearly not. This question does not have a good answer currently on Stackoverflow and is a valuable addition to SO
I think, you could look into Web Components. In particular Lit Element library. Web Components encapsulates HTML, CSS and JS into single custom element. As example, you can have <tab-group> and <tab-group-tab> HTML elements. You can pass objects as attributes as well.
If you don't want to use any library, it is still possible, but requires bit more boilerplate.
Browser support is pretty good already and many large companies are adopting web components at scale.
There are link to some examples - https://stackblitz.com/edit/open-wc-lit-demos

How can one create a complete block in html using Javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I Couldn't find anything on this so maybe you guys could give me some clues if this is possible using JavaScript or not.
Like the question asks, how can I pop an entire block into my html with just using SJ or maybe JQuery?
No not just a div saying Hello and with pretty colors and stuff but an entire block. Meaning a Div with actual content like forms, buttons, spans, links, images and other stuff.
I wanted a temporary popup that wouldn't save data and make the entire project really heavy but instead just appear with some preset values that's called by a JSON script.
Like a temporary form of some sorts.
Everything you are describing is pretty common use of Javascript so it is strange that you did not find anything about it.
There are entire sites written on pure Javascript.
Nevertheless , for a out-of-the-box solution to your inquiry , there is a really good plugin , check it out here : http://trentrichardson.com/Impromptu/.
If you want to learn how to do it yourself , then you should read on the Javascript DOM manipulation functions like :
Node.removeChild()
Node.replaceChild()
Node.insertBefore()
Node.hasChildNodes()
Start from "https://developer.mozilla.org/en/docs/Web/API/Node/appendChild" and go on.
You mean like this http://www.w3schools.com/jsref/met_document_createelement.asp ?
You can add elements to the body of your web page with javascript.

Trying to figure out if a certain website text animation is done with a certain library or plugin [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
If you look at this website and let it load a bit http://visage.co/, you'll notice the text keeps changing and it has some freaking awesome transitions. I figured this is mostly done with some jquery but I was seeing if anyone here has any experience and what they would recommend in recreating something of this sort.
I am guessing you are looking for something like this http://www.mattboldt.com/demos/typed-js/. The page also has some demos from other websites. This would be one way of recreating it.
Please check http://johnpolacek.github.io/superscrollorama/ it is the best library for parallax content in my opinion.

How to apply information submitted in Code Mirror? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am looking to build a personal code playground. Basically I am looking to make 3 Code Mirror text areas for HTML, CSS and JS, Basically I am puzzled on how to make a result box. Any help would be appreciated... Thanks :)
Just to clarify I am looking for a way (I am aware of iFrames) to submit code from 3 "CodeMirrors" and then gets applied to a result area below. I am also looking for pointers as to how todo this as I have only been coding 6 months.
Approach 1 - using iframes:
It's the approach used by jsfiddle. Create 3 textareas to put your code (html, javascript, css). When the user press a button, you can send an ajax request to the server, sending the 3 texts, in order to generate a temporary page that is the composition of the various parts and returning its URL. Then create an iframe that points to it (or update the src of an existing one).
It's quite simple.
Approach 2 - client side:
You can append both the html, css and js in the actual page. It's quite simple, but can generate various issues with conflicting styles, ids and javascript functions/variables names (that you must manage manually).

Categories

Resources