I am trying to create a dynamic selector and dump view the resulting object in the console log:
console.log($('input:first[type=hidden][id$='+ temp +']').parent());
translation: get the parent of the first input which is hidden and where the id ends with ‘temp’
temp is a var that is passed into the function where this statement lives. When I take out the + temp + and replace it with say… 50 (a known number) – I get the result I am looking for. When I try to get the selector to print dynamically, I get an empty result. I have searched and searched for a solution but cannot find a solution.
Thank you for your help!
EDIT:
function removeAjaxContact(aid)
{
console.log(aid);
console.log($('input:first[type=hidden][id$='+ aid +']').parent());
}
console result:
`40
[]`
SELF ANSWERED:
OK – figured it out… I passed the value into from the page as a string instead of an int. not sure why that made the difference, but it did. thank you all for your quick reply and support!!
(Stated above in an edit): OK – figured it out… I passed the value into from the page as a string instead of an int (encapsulated in quotes). not sure why that made the difference, but it did. thank you all for your quick reply and support!!
Update, I have run into this problem in passing other values too, passing an int will randomly lead to getting a lower number in the actual function. I am a little green do diagnose why this is happening. Thanks to you all for the instant help and support!