help needed with basic javascript/jquery
Go to solution
Solved by JanY,
The basic premise you need to get working is:
- you have a button element or something on your site that acts as a button that a user needs to press
- the browser listens to for an event, in this case a mouse click, to be performed on that button
- when it detects that the user has clicked on the appropriate area, it will perform a series of functions
So the concept works, you just need to get the code working.
It's working now, I removed all the Jquery code from the HTML page so I only have the jquery google link and the link to my javascript (end of body):
<script type="text/javascript" src="OpdrachtJquery.js"></script>
Now all the Jquery is in the javascript file:
$("#button").click(function(){
var naam = document.getElementById("naam").value;
var titel = document.getElementById("titel").value;
var score = document.getElementById("score").value;
var tekst = document.getElementById("tekst").value;
var reviews = "\r\n\r\n\r\nTitel: " + titel + "\r\nScore: " + score + "\r\nReview: " + tekst + "\r\nGepost door: " + naam;
document.getElementById("reviews").innerHTML += reviews;
});
I have no idea if this is good use of jquery but it works fine.Thanks for the help.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now