[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how do you have a default value of a hidden input based on a url?

Posted on 2014-08-05
6
Medium Priority
?
141 Views
Last Modified: 2014-08-05
Hi,

I have a function that works great, but I need to add the ability of making a hidden input have a value of "6">

The name of the id of the input is" recipientId"  and here is the function.

Thanks for the help!

<script>
$(document).ready(function() { 
$('.label_copy').hide();
lhash=location.hash
if(location.hash==""){
      $("#GenInfo").addClass("active");
 }
		if(lhash==""){
			lhash="#div6"
			
		}

		$("a[href='"+lhash+"']").closest("div").addClass("active");
		$(lhash).show();
		
$('.show').click(function () {
    $('.label_copy').hide();
    $('#div' + $(this).attr('target')).show();
});

$('.hide').click(function () {
    $('.label_copy').hide();
  
});
});
</script>

Open in new window


Would it be somewhere that "lhash="#div6" is?
0
Comment
Question by:smfmetro10
  • 2
  • 2
  • 2
6 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40242565
So just

$("#recipientId").val("6")
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40242655
In HTML:

<input type="hidden" name="yourHTMLControlName" id="recipientId" value="6" />
0
 

Author Closing Comment

by:smfmetro10
ID: 40242657
Thank You!!
  Out of curiosity why doesn't $("#recipientId") = "6" work?
0
Industry Leaders: 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!

 
LVL 58

Expert Comment

by:Gary
ID: 40242661
That's not how jquery works.
$("#recipientId") is an object, you have to specify what you want to change which in this case is the value
0
 

Author Comment

by:smfmetro10
ID: 40242667
Ah! Thanks!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40242675
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…
Suggested Courses

825 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