On click effect (CSS, HTML, JAVASCRIPT) [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I don't know how to get "onclick" effect. I mean how to open new site by click menu. Below i attached example. Please tell what can i do.
https://bslthemes.com/ryan/demo/index-new-no-photo.htm

With addEventListener you have an univerdal method to respond on the click event. Instead of <div> you may use <button> or any other element, that's up to you.
<div id="whatever">Click me</div>
<script>
document.querySelector("#whatever").addEventListener("click", function() {
window.location.replace("https://stackoverflow.com/");
});
</script>

Related

How to make a onclick iframe make a button visible? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I cant figure out how todo this if i can get any help it would mean alot ove been stumped for the last hour looking everywhere for an awnser maybe im searching the wrong this i dont know. please help thanks!
Add this code to your page inside your iframe. The button will be hidden (see inline style css), when you click within the iframe the click event fires on the body element and displays the button. Uses jquery.
<body id="body">
<input id="Btn1" type="button" value="clickMe" style="display:none;">
</body>
$("#body").click(function(){
$("#Btn1").show();
});

jQuery - change value of Div ID [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have this:
<div id="something">
content
</div>
And I need change something to somethingnew by using jQuery, so:
<div id="somethingnew">
content
</div>
How can I do it? I've tried function attr, but it doesn't work.
Thanks for advices.
This this:
$("#something").attr("id", "somethingnew");
Try this.
$("#something").attr("id","somethingnew");
$("#something").attr("id", "somethingnew"); should work just fine

How to combine page url and javascript? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have link that need url of the page, how to get the page url then insert in the link url with JavaScript?
For example, if the page url is http://example.com/blabla/blablabla/bla/
and i don't know how to make JavaScript that combine page url and JavaScript.
GoToLink
to link like this
GoToLink
GoToLink
give it an ID then manipulate throw javascript
<a id="a1" href="#" rel="nofollow">GoToLink</a>
<script>
document.getElementById("a1").href="http://link.cu/abc="+window.location.href;
</script>

Display and hide a div onclick [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is a demo of a sidebar, when i click on login it should display the login form, and when i click again it should hide it.
I don't know how to do that. Any hints?
I have also another problem, the bar hide part of the content how to solve that?
Thank you very much for any help.
Demo: http://jsfiddle.net/Iuppiter/uDxH6/61/
// Clicking here will show/hide the div
Login
<div id="login-form"> ... </div>
Without using Jquery maybe.
With only the code your provided you can do this.
http://jsfiddle.net/uDxH6/62/
$("#login-form").hide();
$("#other-bar-top a:nth-child(4)").click(function(e) {
$("#login-form").slideToggle();
e.preventDefault();
});
Make sure to include jQuery on your website.
Can you try this,
HTML:
Login
Jquery:
$(function(){
$("#login-form").hide();
$("#login").click(function(){
$("#login-form").toggle();
});
});

Add event on dynamic change of DIV [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have a page (Facebook page) that has its content changing dynamically. I am writing a GM script but it only loads when the page refreshes, and this is not the case. I have tried to do something like:
mydiv.addEventListener('load', myfunc() ,false );
as I saw in a different thread, but it didn't work. What am I doing wrong?
Thanks.
Use setInterval() or the waitForKeyElements utility.
Can't give any more detail unless you provide specifics like: what, exactly, you are trying to do; before-and-after HTML; or even a link to the page and/or screenshots.
Change myfunc() to myfunc.
Using myfunc(), you are calling the function.
While myfunc is just passing the reference to your function.

Categories

Resources