javascript - Uncaught TypeError: Cannot read property 'match' of undefined -


I check that some fields are matches or are not empty, but I get this error with this piece of jQuery.

Untitled Type Error: Undefined property 'match' can not be read

Can anyone tell me what I am doing wrong here?

  if (width.match (/ ^ \ d + $ /) & height. Match (/ ^ \ d + $ /) & amp; amp; amp; type Length & gt; 0 & amp; This is the full code:  
  if ($ ("#config")) {$ ('input, selection') .on ('change', Function () {var width = $ ("# config-steps #width") .val (); var height = $ ("# config-steps #height") .val (); var type = $ ("# config -steps #type ") .val (); var color = $ (" # config-steps # selected-color ") .val (); if (width.match (/ ^ \ D + $ /) & height Match (/ ^ \ D + $ /) & amp; amp; amp; amp; amp; amp; amp; amp; Color; lamps & gt; {$ ("#checkout - Message") Change the show (); // visible value $ ("#change-value"). Html (calculate_price (). ToFixed (2));} and {return false;}} ($ ("#config"));}  

   

Always be true with jQuery because jQuery returns an object and the objects are true. The length of the check should be checked, which will return a number and the zero will be incorrect.

  if ($ ("# config"). Length) { 

Now when jQuery is missing any element, (return) from the value Will come, so this element is not searching.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -