0
function removeItem(){
    for(i=0;i<rowData.length;i++){
        if(rowData[i].title = 'First Name'){
            rowData.splice(i,1);
            break;
        }
}

This does not delete the object whose has a title property 'First Name' instead deletes the last added object to the array.

2
  • Did u try using == to compare strings instead of = ? Commented May 1, 2011 at 21:20
  • If you really have = in your code, it should actually delete the first element.... Commented May 1, 2011 at 21:23

2 Answers 2

1

You have to use == operator instead of = in the if condition.= is for assignment and not for comparing.

Edit 1: For more info follow this thread.

Sign up to request clarification or add additional context in comments.

Comments

1

On line three you have a typo. Instead of =, it should say ==

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.