Xtremer360 Posted January 17, 2011 Share Posted January 17, 2011 I have this code: $('#menuitemform select').change( function() { $( '#menuitemform select' ).not( this ).val( 0 ); }); to prevent the user from making a selection from more than 1 select dropdown however I want to add something to this but not sure how. Along with this I want to make the user not be able to also have any input inside the text box with an id of itemurl if one of the 3 dropdowns has had a selection made. If one of them does then it erases/empties the users input. Quote Link to comment https://forums.phpfreaks.com/topic/224741-emptying-user-input-based-on-dropdown/ Share on other sites More sharing options...
Xtremer360 Posted January 17, 2011 Author Share Posted January 17, 2011 This part works. However I was trying to come up with a way to do the exact opposite. I tried flipping things around but that didn't work. Any ideas. What is happening with this code is that when there is a selection made with one of my 3 dropdowns it will reset the others back to 0 for their value as well as if the user made input into the text box with the id of itemurl then the value of its text was erased. I'm trying to the opposite as well. When there is user input into the text box it will reset the values of the dropdowns to 0. The end result means on form submission there would only be a value for the item url or any of my 3 dropdowns. $('#menuitemform select').change( function() { $( '#menuitemform select' ).not( this ).val( 0 ); if ($("#menuitemform select").val().length > 0){ $("#itemurl").attr("value",""); } }); Quote Link to comment https://forums.phpfreaks.com/topic/224741-emptying-user-input-based-on-dropdown/#findComment-1160983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.