Shyju
Shyju

Reputation: 218722

jQuery :cant use split function

I am using jQuery autocomplete pluggin .

I have the following code

$().ready(function() {

    function findValueCallback(event, data, formatted) {
        $("<li>").html( !data ? "No match!" : "Selected: " + formatted)
            .appendTo("#result");
    }

});

I am trying to split the value coming in data.When i alert it,It is showing properly.But i cant use a split method to extract some data from it .(the data is "ASP.ASPItems.23" , I want to take that 23 from it

When i use split,I am getting an error like "split is undefined"

My split code

var subjectId=data.split(".")[2]

CAn any one advice how to go ahead

Upvotes: 0

Views: 16739

Answers (2)

Bugfixer
Bugfixer

Reputation: 2617

var values = $("input[name='campstarttime\\[\\]']").map(function(){return $(this).val();}).get();

var result = values.toString().split(",") ;

alert(result[1]);

Upvotes: 0

samjudson
samjudson

Reputation: 56853

Well seeing as split is a method defined on a string, have you considered trying data.toString().split(".") or String(data).split(".") ?

Upvotes: 14

Related Questions