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
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
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.
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 7 years ago.
Improve this question
What should I do to enable users of my website to type in something to a search bar and have it query my mongodb? I am using meteor JS so perhaps that will help with an answer. Thanks.
There are a few good meteor packages out there depending on what kind of functionality you need. I would suggest checking out meteorhacks:search-source, which will implement instant search for you, and does most of the work behind the scenes.
Check out https://meteorhacks.com/implementing-an-instant-search-solution-with-meteor.html for a good intro tutorial.
You could add a 'change' event handler on your <input> element and fire off a jQuery $.post request. Consider this:
$('#input-box').change(function() {
var postData = $(this).val();
$.post('/your/url', postData, function(dataFromMongoDB) {
// Query MongoDB on the server and return the data
console.log(dataFromMongoDB);
});
});
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 would like to pass variables from a button to an input form on another page.
For example,
The user clicks a button with the package they want, the button loads the next page and fill out the form with the package information they have selected. What is the best way to go about this? I am designing the website using Joomla.
Thanks,
Ed
I can suggest you to use localStorage to get this done.
localStorage.setItem('testObject', value);
then get it on other page like this:
var retrievedObject = localStorage.getItem('testObject');
then set the text field with retrievedObject .
see this post to get better idea:Storing Objects in HTML5 localStorage
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
Recently I decided to learn Javascript and have been trying to create a script that will put a border around empty elements before the form is submitted. Essentially I want the form to be live validation and notify the user before they click submit. Any help would be greatly appreciated.
There are very many plugins if you want to use jQuery as your title suggests:
http://www.jquerybyexample.net/2014/05/15-useful-jquery-validation-plugins.html
Just pick whatever you want :-)
Or if you want to use plain JS, just search "javascript form validation" on google, you'll find thousands of entries, e.g.
http://www.learn-javascript-tutorial.com/javascript-form-validation.cfm and http://www.tizag.com/javascriptT/javascriptform.php
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
Is it possible to post with javascript or jQuery (not via ajax, by the same way as form i posted) without creating form element? How?
No. You cannot make a POST request without using a <form /> tag, without using AJAX.