php - Jquery check multiple Selects have value set -


I have a form with a number of selected areas, so you can select several entries per selection.

Each selection has been named id1 [] , id2 [] , id3 [] etc.

While trying to submit with Jquery, can I check the form whether there is no selection in any selection?

I have tried to do this, but the form is still present.

  $ ("$ submit" (. ($ (This) .val () == ""). Click (function () {$ ("[name = = 'id' ]: Select "visible"). Each (function (index, element) {if ($ (this) description is false;});});   

I do not need to know There is no option to select which specific 'id', but if it did I would have been good ..

thanks

You can use the function to return all the selections, which are any values Not selected

  var withNoValue = $ ("select [name = = 'id']: visible"). Filter (function () {return! This.value.length;} );   

Then you can check to see if you have no value - and you have access to those elements too

  if (Also select. Length) {// if selected with a value, // something to do}   

Since then you have to submit the form handler to Bind so that instead of a click of a button

So if you want to stop the form you can do this

  return! Select withNoValue.length   

If any selection is selected with a value then false return will be



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -