![]() |
Javascript to target specific form name?
I have a form that loads with the following hidden field:
Code:
<input type="hidden" name="packageID" value="1" />What I want to do is customize the form a bit based on the value using something like this: Code:
var package = document.getElementsByName("packageID"); Thanks! |
Assign an id = "packageID" to the field and then use
var package = document.getElementsById("packageID"); All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit. |
I'm not trying to assign a PackageID, that's already done, I want to hide fields and force values depending on whether the PackageID is a 1 or 4...
Thanks |
If "PackageID" is, indeed, the ID of the element then you need to use
Code:
document.getElementById("PackageID")Code:
document.getElementsByName("SomeName")Code:
document.getElementsByName("SomeName")[0] |
Guys, thank you so much for your help, and please excuse my ignorance if I wasn't getting the message you were trying to relay. I wasn't trying to add an ID to the field, nor did I want to since this is a Wordpress plugin, and I'd rather not customize it so that I can have clean updates in the future. It was adding the [0] that the did the trick....now if I could ask one more question?
How to I hide a div id/class? Using Code:
$("#field_price_current_wrapper").hide();Thanks again! EDIT: Managed to hide the div using: Code:
field_price_current_wrapper |
| All times are GMT +1. The time now is 07:00 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.