jQuery.Range.static.start  function     

Gets or sets the start of the range.

If a value is not provided, start returns the range's starting container and offset like:

$('#foo').range().start() //-> {container: fooElement, offset: 0 } 

If a set value is provided, it can set the range. The start of the range is set differently depending on the type of set value:

  • Object - an object with the new starting container and offset is provided like

    $.Range().start({container:  $('#foo')[0], offset: 20})
    
  • Number - the new offset value. The container is kept the same.

  • String - adjusts the offset by converting the string offset to a number and adding it to the current offset. For example, the following moves the offset forward four characters:

    $('#foo').range().start("+4")
    
$.Range.start(set) -> jQuery.Range|Object
{optional:Object|String|Number}

a set value if setting the start of the range or nothing if reading it.

{jQuery.Range|Object}

if setting the start, the range is returned for chaining, otherwise, the start offset and container are returned.

© Jupiter IT - JavaScriptMVC Training and Support