• I am trying to create a snippet that will iterate over a group of radio buttons and change their background color based on sql query results. I am trying to make a jQuery script with the .each() function to do the iteration and pass the element’s value to the SQl query. But I am not sure how to do that. This is what I basically want to do:

    <script>
    	var $j = jQuery.noConflict();
    	var $timeSlot = "";
    	/* write your JavaScript code here */
      	$j( "radio.el-radio-button__orig-radio" ).each(function( i ) {
    		$timeSlot = this.val();
    		queryResults = /*sql query with timeSlot value passed*/
                    /* if queryResults == 1 then this.css-background = "blue" else if queryResults == 2 then this.css-background = "green" else if this.css-background == 3 then this.background == "red" /*
      	});
    
    </script>
    • This topic was modified 3 years, 8 months ago by gercamjr. Reason: forgot to add the $j
  • The topic ‘SQL Query with jQuery variable’ is closed to new replies.