[jQuery] Hiding elements that have a dynamic ID

[jQuery] Hiding elements that have a dynamic ID


Hi there,
There is a particular ID in my web page that changes dynamically
according the input given in one of my text boxes. It's generic name
is called '_MISendFormShortcutfalse'. Then the input in one of the
textboxes is put at the end of the ID name. That is to say if 'Test
Example Shortcut' was the input in the textbox, it would result with
the ID name '_MISendFormShortcutfalseTestExampleShortcut'.
From the above there are two issues:
1) The name of the ID changes dynamically.
2) The given input, that is put behind the generic name, will have all
the spaces inbetween removed.
These are my current codes to overcome the issue:
//The dynamically changing name and method to remove the spaces for
concatenation to the
//generic name
var tempFalseHolder = $("#new_name").val();]
while(tempFalseHolder.match(" "))
{
tempFalseHolder = tempFalseHolder.replace(" ", "");
}
//Concatenation of ID names
var idFalseHolder = "#_MISendFormShortcutfalse" + tempFalseHolder;
//Hiding the dynamically changing ID element
$(idFalseHolder).hide();
Thus, am wanting to check with any of you out there, who can lend me
your expertise in using other methods made avaliable in jQuery to do
the abovementioned.
Thanks!
Regards,
Christopher TS