Link to home
Start Free TrialLog in
Avatar of smfmetro10
smfmetro10Flag for United States of America

asked on

how do you check for two parameters with jquery

Hi,

I'm trying to check the url for either "ID_xxxxx" or "CON_ID_xxxxxx"

The "x" is either a five or six figure number

This is what I have so far. Thanks for the help!

<script type="text/javascript">
        $(document).ready(function () {
            if(window.location.href.indexOf("ID" || "CON") > -1)
            {
                 alert("found it");
            }
			
        });
    </script>

Open in new window

Avatar of HainKurt
HainKurt
Flag of Canada image

if(window.location.href.indexOf("ID" || "CON") > -1)

>>>

if ((window.location.href.indexOf("ID") > -1) || (window.location.href.indexOf("CON") > -1))
Avatar of Gary
I assume you want the xxxxx part so what's an example url

(or maybe not)
Avatar of smfmetro10

ASKER

Ah - it would either be "ID_12345" or" CON_ID_123456"
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!