I have a checkbox with the values of "new" or "existing" company.
$ ("input [name = company]: checked"). With jquery () , jQuery shows me the value of the check box.
Now if I do:
if ($ ("input [name = company]: checked"). Val () == "new") {is_new_company = True; } And {is_new_company = false; } Alert (is_new_company); I get the right bullion.
Shortcut:
($ ("Input [name = company]: checked"). Val () == "new")? Is_new_company = true: is_new_company = false; I could not find anything .. why is that?
Why do not you just:
is_new_company = $ ("Input [name = company]: checked"). Val () == "new"; I tried to code your code on the Firebug console and it works fine: ( input [name = q] search at the top right corner of this page Box)
var x; $ ("Input [name = q]"). Val () == "asd"? X = "T. RUE": X = "FLAS"; Console.log (x); // is used as expected By the way, I think to be more readable on the following (I will only use it for non-boolean values, of course) :
x = $ ("input [name = q]"). Val () == "asd"? "right wrong";
Comments
Post a Comment