To use jQuery you need to load jQuery into page if not already loaded.  Following code snippet shows loading of jQuery.

Plugin Name: Test Jquery
Plugin URI:
Description: jquery test
Version: 1.0
Author: (put your name here)

add_action( 'wp_enqueue_scripts', 'load_scripts' );

function load_scripts(){

add_shortcode('testjquery', 'shortcode_fnc');

function shortcode_fnc(){
		<form id="fm1"  name="whatever" method="POST" action="">
				<input class="fm1" type="text" name="student_name" id="sname" />
				Please Enter Name
				<input type="text" name="gender"  id="gender" />
				Please enter gender (Male or Female or NTD )
			<input id="submit" type="submit" name="testjquery" value="Test jQuery">
					var g = jQuery('#gender').val();
					if( g != "Male" && g != "Female" && g != "NTD"){
						alert('Please enter a valid value for Gender, value entered is ' + g);
					return false;
			  return true;