jquery - Error: Syntax error, unrecognized expression: dot (.) -


मेरे पास एक jquery स्क्रिप्ट है जो इस तरह से आता है:

  $ ('।' + Ajax_object.cartclass) .on ('click', 'a.add', फ़ंक्शन (e) {e.preventDefault (); // निकटतम पैरेंट डिवा var cpd = $ (this) .closest ('div.cartpn') प्राप्त करें ; Cpd.addClass ('code');  

...

'।' किसी कारण के लिए समस्या होने लगता है

त्रुटि: सिंटेक्स त्रुटि, अपरिचित अभिव्यक्ति:।

किसी भी विचार क्यों?

< Div class = "post-text" itemprop = "text">

सुनिश्चित करें कि ajax_object.cartclass ठीक से परिभाषित है।

  var ajax_object = {}; Ajax_object.cartclass = "testing"; // जिस वर्ग को आप सुनना चाह रहे हैं।  

आपकी कोड को उसके बाद ठीक से काम करना चाहिए, यह मानते हुए कि आपके पास वर्ग Ajax_object.cartclass जिसमें एक a तत्व का वर्ग जोड़ें :

  & lt; div वर्ग = "परीक्षण" & gt; & lt; एक वर्ग = "जोड़" & gt; यह परीक्षण करें & lt; / a & gt; & lt; / div & gt;  

निम्नलिखित कार्य करना चाहिए:

  $ ('।' Ajax_object.cartclass) .on ('click', 'a.add', फ़ंक्शन (e) {console.log ("hey"); // कंसोल अब "हे" आउटपुट करेगा। E.preventDefault ();});  

आपके कोड को उसके बाद ठीक काम करना चाहिए।

यहां एक है।


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -