Jump to content

Emptying User Input Based On Dropdown


Xtremer360

Recommended Posts

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.

Link to comment
Share on other sites

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","");
            }
        });

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.