See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Display default data for list box using jquery

Course Queries Syllabus Queries
Max. 2000 characters

Jasmin Bhasin


( 5 months ago )


I have two list boxes, one for grade and another for subject. Upon change of grade the subjects are populated in the subject list. The values for both the lists are populated using ajax calls. Upon selection of subject the relevant syllabus is populated.

 <select id="gradeSelector">
   <option value=11 > 11</option>
   <option value=12 selected="selected"> 11</option>

 <select name=subjects id=subjects>
   <option value=0 selected="selected"> Maths</option>
   <option value=1 >Science</option>

My question is, on page load I would like to load default grade,subject and syllabus.

I tried doing this:

  $("#gradeSelector").load('change',function(){ /*the options are populated here*/});

  $("#subjects").load('change',function(){/* the options are populated here*/});

It helps display the syllabus of default subject and grade but I am unable to change the value of list box any further.

Could somebody throw some light please.

Alex Wilson


( 5 months ago )

You can fill default data in dropdown on page load as follows:

$(document).ready(function() {

what's your interest