GithubHelp home page GithubHelp logo

dom-crawler's Introduction

DOM-Crawler

This is a simple DOM Crawler base on JavaScript. You can select your context area with a simple jQuery-like selector and retrieve all data in that context.

Basic setup

HTML

You just need to attach a selector to your context area, i.e. an id attribute as #myForm in your <form> tag. You markup should seems like this:

<form id="myForm">
  <input type="text" name="field1" data-autocapture data-extra="extra_data" />
  <input type="checkbox" name="field2" data-autocapture />
  <input type="submit" name="field3" data-autocapture />
</form>

Load JS librarys

Load the Crawler class.

<script src="js/crawler.js"></script>

Istance the class

Istancing the class without extended parameters is easy:

var crawler = new Crawler();

Default parameters

Without using extended settings, the Crawler class will look for input tags with data-autocapture attribute. Extra data can be passed through data-extra attribute.

Extended parameters

In the case you are using extendend settings while istancing the Crawler class In progress

Example

After istancing without extended settings, no selector is setted. Remember to set it through setSelector(<insert your selector here>)or specify the jQuery-like selector in getData function:

var data = crawler.getData('#myForm');

You can also declare the selector while istancing and retrieve data without specifying the selector.

var inputCrawler = new Crawler('#myForm'); // All inputs in #myForm
var data = inputCrawler.getData();

dom-crawler's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.