Elxn
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).
The HTML:
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!
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;
}
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…</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>
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This should work too if you change the ID's so its close enough.
ASKER
Sorry EE, don't know why i just thought of the answer!