Link to home
Start Free TrialLog in
Avatar of Elxn
ElxnFlag for United States of America

asked on

jQuery / Javascript Question

I have a simple jquery script that works on one page, but when I use it on another page it doesn't work.

I have a simple script that checks if a file input is empty, and if it is not empty it checks if a select box has a value.  If the file is there but the user hasn't picked the image type it should return false and display a little error message.  But it doesn't work!

See the problem Click Here  then click the profile picture link that says update your picture (it will appear when you hover over it).

if($("#upload_pic").val() != ''){
					  	alert("in");
						  if($("#pic_type").val() == 0){
							$("#pic_type_alert").show(); 
						  }
						  return false;
					  }

Open in new window


The HTML:
<form id="update_status">
				<input type="file" id="upload_pic" name="initial_profile" />
				
				<select id="pic_type" name="pic_type" style="margin-top:4px;">
						<option selected="selected" value="0">Choose a Pic Type&#8230;</option>
						<option value="1">option</option>
				</select> <span class="hide" id="pic_type_alert" style="color:#FF0000; font-size:11px; font-weight:bold;">* Choose Type!</span>
				<textarea placeholder="Add a Description to your Picture..." name="description"></textarea>
				</form>

Open in new window


Also you can use Chrome to see the code that ajaxed in to the page and get a better idea of whats going on.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Elxn

ASKER

My dumb ass just figured it out.  I had another form with the same ID's in it.  I just changed the ID's on the code and it worked fine.

Sorry EE, don't know why i just thought of the answer!
Avatar of Elxn

ASKER

This should work too if you change the ID's so its close enough.