Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is here :</p> <pre><code>var s; AddEvent.init(s); </code></pre> <p>There is no way after this to have <code>s</code> defined.</p> <p>A solution would be to simply not pass <code>s</code> (and no declare it in the arguments of the function) :</p> <pre><code>init:function(s){ s = this.settings; ... AddEvent.init(); </code></pre> <p>But that lets a variable polluting the global namespace.</p> <p>If you want your <code>settings</code> to be accessed from all your functions, you could embed in in a closure :</p> <pre><code>var AddEvent = (function(){ var settings; return { init:function(){ settings = { saveButton : $('#uploadfiles1'), cancelSpeech : $('.cancelSpeech'), datePicker : $(".datepicker"), eventName : $('input[name=eventname]'), eventDate : $('input[name=eventdate]') }; this.BindEvents(); $('.Wallpapers').addClass('active'); $('input, textarea').placeholder(); }, BindEvents:function(){ this.CancelButton(); this.DatePicker(); // this.SaveButton(); $('input[type=text],textarea').on('keyup change',function(){ AddEvent.FieldsCheck(); }); }, CancelButton: function() { settings.cancelSpeech.on('click',function(){ var referrer = document.referrer; window.location = referrer; }); }, DatePicker :function() { settings.datePicker.datepicker({ //defaultDate: +7, showOtherMonths: true, autoSize: true, //appendText: '(dd-mm-yyyy)', dateFormat: 'dd/mm/yy' }); }, SaveButton: function() { this.ClearFields(); }, FieldsCheck: function() { alert(settings.eventName.attr('name')); if(settings.eventName.val()!='' &amp;&amp; settings.eventDate.val() !='' &amp;&amp; $('textarea').val()!='') { settings.saveButton.removeAttr('disabled').removeClass('disabled'); } else settings.saveButton.attr('disabled','disabled').addClass('disabled'); }, ClearFields:function() { $('input,textarea').val(''); this.FieldsCheck(); } } })(); $(function(){ AddEvent.init(); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload