JSFiddle - React, Tailwind, and code Playground

by Chase Wilson

JavaScript

(function (win,doc) {

function buildOption (wrapperEl, index) {
  console.log(wrapperEl, index)
  var option = {}
  return option
}

var Poll = function (id) {
  this.initialize(id)
}


Poll.prototype = {

  initialize: function ( id ) {
    var self = this
    if ( typeof id === 'string' ) {
      self.id = id
      self.wrapper = jQuery('#'+id)
    } else {
      self.wrapper = $(id)
      self.id = self.wrapper.attr('id')
    }

    // if ( self.wrapper ) {
    //   self.wrapper.children().hide()
    // }

    var options = $.map(Array.prototype.slice.call(this.wrapper.find('.poll_option')), buildOption)
    console.log(options)

  }

  ,submit: function ( optionId ) {
    polls.submit('poll_results_3144', 'poll_questions_3144', 'poll_submit_row_3144', 'http://tabs.vitrue.com/wall_modules/73679/polls/3144/vote?draft_mode=true&store_id=13853', false, 13853); return false;
  }

}

win.Poll = Poll

console.log('something')
var poll = new Poll('module_73679')
console.dir(poll)

}( window, document ))