i am working on object from which i want to remove a value on specific address. i need the position of element and want to remove it from object
here is the code :
var matches = {
"users-email": "email",
"users-activated": "activated",
"users-created_at": "created_at",
"users-registration_page": "registration_page",
"profiles-firstname": "firstname"
} ;
var option = 'firstname';
var if_in = $.inArray(option, matches );
//console.log(matches)
if( if_in !== -1 )
{
matches.splice(if_in, 1);
}
$.each(matches , function(i,v){
$('.test').append(v+'<br>');
});
in my object $.inArray() not working it return -1 .
can someone help me to find this issue .
$.inArrayonly works on arrays.matchesisn't an array.$.inArraypreviously, so what? In this case it wont do what you're hoping (expecting?)$.inArray not worting on objectNo, it isn't, what makes you think it should?