.split is not a function

5.2k views Asked by At

Recently i've updated jQuery / jQuery UI of my php/javascript system with jQGrid free in it's latest version and after implemented the use of jQuery 1.11.3 and jQuery Migrate 1.4.1.

After several bugs fixed got stuck into this (by the way, i've already searched and tried with stackoverflow references of past resolved questions):

var formid = $(".FormGrid");
var form = $(formid).attr("id").split("-").pop();

ERROR:

$(...).attr(...).split is not a function
1

There are 1 answers

0
Alex Ribak Neto On

Since undefined means in another words "not set" or "empty", setting a condition to check the return type and it is able to handle errors allowing the method to be called only when requirements meet like a string with some text in it.