

Url = url.substring(0, (url.indexOf("#") = -1) ? url.length : url.indexOf("#")) //this removes the anchor at the end, if there is one Here is my current code function getFileName() It seems when I open the url that is in the 2nd part of the OR statement, it doesn't pick up the name, and executes the default case instead. Any advice?įollowing advice, I revised my script to the following, which I thought solved my problem, however it does not entirely. This seemed to work, however on further testing, I found that the case statements that did not have break did not fall through as I'd expected. So, I revised my script to: switch(url)Ĭase "userNewItemForm.aspx": //intentionally left blank to fall throughĬase "userEditItemForm.aspx": //intentionally left blank to fall through My first thought was to use the logical OR in my case, such as: case (url="userNewItemForm.aspx") || (url="adminNewItemForm.aspx"):Ĭase (url="userEditItemForm.aspx") || (url="adminEditItemForm.aspx"): I am getting the name of the file to differentiate btw New and Edit forms and then doing something based on that.

I found out that the syntax would be switch(n)Ĭode to be executed if n is different from case 1 and 2 I'd like to combine these two files into one jQuery file and I wanted to use a case statement.

I have two jQuery files- one being called on userNewItemForm and adminNewItemForm, another being called on userEditItemForm and adminEditItemForm.
