Solved

Determine if tag contains certain parameter

Posted on 2013-05-23
5
182 Views
Last Modified: 2013-05-23
<form method="post" action="Asset.aspx?MenuId=409&amp;AssetTaskID=2841409-1&amp;AssetID=34878-1&amp;IsPopup=true"

vs

 <form method="post" action="Asset.aspx?MenuId=396&amp;AssetID=34878-1" id="frmMain" enctype="multipart/form-data">


I want to know if the <form /> tag contains the   "IsPopup" parameter and do something if it does / does not.
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39191203
Add id attribute to the form and use this jquery:
if($("#myForm").attr('action').val().insexOf('IsPopup')>-1){

}
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39191206
indexOf not insexOf.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 39191226
Okay.

Now, what if I do not want to add attribute "id".   Can it still work?

I do not want to disturb the way the form tag is currently rendered.
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39191265
Its not gonna affect the form at all.
U can also use class instead of id and then replace the # character with . (dot)
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 39191312
My final solution:

if ($("form#frmMain").attr('action').indexOf('IsPopup') < 0) {  

            $('input').attr('disabled', true);
            $('select').attr('disabled', true);
            $('div[id*="divSave"]').css('display', 'none');
            $('span[id*="spnCalculateTotals"]').css('display', 'none');
        }

Open in new window


Thank you for your help!!  :  )
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question