0

I have the following script:

var id = $(this).attr('id');
var ui_id = id.replace("delete", "hidden");
var am_id = id.replace("delete", "internal");

If I do

console.log(id);

I get the following value:

widget-zcircle-2-link_image-remove

But the values of ui_id and am_id are not changing.

The following code :

console.log(ui_id);
console.log(am_id);

print out in my console the following result:

widget-zcircle-2-link_image-remove
widget-zcircle-2-link_image-remove

instead of

widget-zcircle-2-link_image-hidden
widget-zcircle-2-link_image-internal

Is something wrong in my code that I cannot see ?

Kind regards Merianos Nikos

2
  • 2
    remove and delete cant be same Commented Jul 9, 2012 at 10:27
  • 2
    You have remove in the id and try to replace delete Commented Jul 9, 2012 at 10:28

2 Answers 2

4

Replace delete from remove in your replace function... just like

var ui_id = id.replace("remove", "hidden");
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot Talha. I realy feel so shy, was extremelly easy :(
2

Your input contains "remove" but your code is looking for "delete".

3 Comments

You are so right !!! I am realy so shy :(. Thanks a lot Jon. I will mark that as answer ! :)
Συμβαίνει και στις καλύτερες οικογένειες Νίκο. Καλή συνέχεια!
Έχει δίκιο !! Περιμένω να περάσει λίγη ώρα και θα επιλέξω την απάντηση σου ως σωστή. Ευχαριστώ πολύ και πάλι !!

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.