jquery - determine whether dropdownlist is selected or not -


Trying to send post data via AJAX - Code has tried so far,

  var $ input = $ ('# myform: input'); Var values ​​= {}; $ Inputs.each (function (i, region) {if ($ (this) .is (': text')) {// alert ("id:" + field.id + "value:" + field.value) (Value: field = value =) if ($ (this) .is (": radio")) {var v = $ (this) .attr ('checked') if (v == true) {value. Name] = $ (this) .val () //alert($(this).attr('checked '))}} If ($ (this) .is (": checkbox")) {var v = $ ( This) .attr ('checked') if (v == true) {values ​​[this.name] = $ (this) .val () // alert ($ (this) .attr ('checked')) }} Alert ($ (this) .is (": hidden")) ($ (this) .is (": hidden")) {value [field.name] = field.value} // alert ("dropdownlist : "+ $ (This) .is ('option: selected')); //values[field.id] = field.value});  

This works fine, but I want to determine whether the dropdown list has been selected or not - based on this, I have value [field.id] = Field.value
Is there a way to learn about the dropdown list? $ (this) .is (': checkbox') is the same, $ (this) .is (': text')
Any help will be valuable

You can see that it is a & lt; Select (gt; element), like:

  $ (this) .is ("select")  

Since any selector Just use a :).

Although from a complete perspective, you feel that the underlying functionality is being repeated, take a look and you try it beforehand For example,:

  $ Post (url, $ ("# myform"). Serialize ());  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -