I have a webpage which utilizes javascript, and I have a .js file declared separately (I need it to be separately) Here's what's in the code:
$(document).ready(function() {
$(document).on('click', 'input[name="rating"]', function() {
var sf.gav = $(this).val();
alert(sf.gav);
});
});
However, no matter what I do or how I declare sf.gav, it is never saved so that I can use it later on the page (the code itself works and shows the number). It just says "undefined". Any advice?
Edit:: Thank you for your answers! I'm going to clarify a bit: I am using a game engine called "tyranobuilder" and it has its own variables. Only its own variables can be passed to another code that I need, specifically, a button that "submits" the information (the whole page is just a giant swarm of radio buttons). Therefore, I was looking for a way to get a value from jquery that I can then pass on to the button (first declaring "f.value = sf.gav"), which will in turn set in motion another script. After that, the initial value passed by the jquery can be forgotten. This button, and the declaration "f.value = sf.gav", are, obviously, at the end of the radio buttons. So far, even with your generous attempts at helping, nothing works..