Solved

Determine if tag contains certain parameter

Posted on 2013-05-23
5
177 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
  • 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

762 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