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 4 years ago.
Improve this question
I am trying to add an if statement to the code on the bottom, I was able to add console.log and it worked but need to have it where it goes something like "if(something).onClick open this page" please help.
$.myFunc = function(){
console.log("clicked");
}
I think you are asking about on click event? For example user click on button you want to perform an action?
You need to give id or class to that element and using jQuery you can listen to the onClick event when it gets triggered.
$("#button").click(function(){
//your code here
});
No need to put if condition in function.
P.s - Use # for id and . for class.
Related
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 4 years ago.
Improve this question
Is there a way to make an object submit button?
By clicking an object such as image, I want to submit.
Can anyone give me an clue?
You can use jQuery, it's very simple:
// Listen for a click on an element
$('#objectId').click(function() {
// Do something, like submit a form
$('#formId').submit();
});
you can use ajax to show information from database. For simple using ajax - download jquery or axios.
Example:
jquery ajax documentation
axios documentation
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 8 years ago.
Improve this question
I am trying to finish my application but to do so I want to create a popup that will be triggered when a link containing the class of "extlink-modal-trigger" this will trigger a popup/dialog that shows a quick warning like Facebook and when its clicked it will pull the href with it and insert it into a button
Hopefully you understood that but if you dont then please give me a comment sorry if this lacked any detail
I'm trying to create something similar to this http://jsfiddle.net/GsCBr/
$('a[href^=http]').click(function(){
alert('You are leaving this website.','Warning');
});
But It will only be trigger if it has the appropriate class and it should show as a popup
You can do this in following way:
$(document).ready(function () {
$('a.extlink-modal-trigger[href^=http]').click(function (e) {
e.preventDefault();
alert('You are leaving this website., Warning');
$("#link").html(this.href); //do whatever you want with link
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Click here to leave site.
Click here to leave site.
<button id="link"></button>
Working fiddle with bootstrap modal
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
I want to do is make those buttons with class btnd that are not disable not clickable to the users.
current output: http://jsfiddle.net/6VrXD/44/
If you mean you want the clicking to cause nothing you could use...
$('.btnd:not(disabled)').on('click', function(e) {
e.preventDefault();
});
I have no idea if this would cause what you want thought as it's not at all clear what you actually are looking for and more importantly why.
The buttons already do not do anything since there is no event attached. To give the front-end visual feedback I would suggest changing the cursor to the default.
.btnd {
cursor: default;
}
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
I am building a website (Static HTML Website). In my index page, I have an image slider. I used JQuery for that. On clicking any image, that will pop up. And there is a link, for which I used another JQuery function. On clicking that link, a window will pop up. But the problem is that I am not able to use both of them at the same time. I defined both the functions inside
$(document).ready(function () { });
Is it because of that??
$(document).ready(function () { });
Is just making sure nothing inside get's fired before the whole page is loaded.
I think you could get much more specific help if you would post the whole code.
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 i click a division it will slidUp and if i click that division again it will slideDown.
How can i do this ?
$("#id_color_tags").click(function(){
$("#rightsidefive").slideToggle();
})
Tried that but that didn't work.
Put an alert in the click event, are you getting to the function?
Are the names right. asp.net can alter names so maybe select on a class name instead. So <div class="thisclass"> and the selector then becomes ".thisclass"
Same applies for the #rightsidediv
Failing that, post some HTML so we can see.