• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Determine if tag contains certain parameter

<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
Tom Knowlton
Asked:
Tom Knowlton
  • 3
  • 2
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
Add id attribute to the form and use this jquery:
if($("#myForm").attr('action').val().insexOf('IsPopup')>-1){

}
0
 
Meir RivkinFull stack Software EngineerCommented:
indexOf not insexOf.
0
 
Tom KnowltonWeb developerAuthor Commented:
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
 
Meir RivkinFull stack Software EngineerCommented:
Its not gonna affect the form at all.
U can also use class instead of id and then replace the # character with . (dot)
0
 
Tom KnowltonWeb developerAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now