robrodp
asked on
passing the value of a checkbok to JavaScript
I have a table and can access the data in the table with
var name =$(this).closest('tr').fin d('td:eq(1 )').text() ;
$('#dialog-form input[name="empresa"]').va l(Empresa) ;
No problem
However when I try to pass the vale of a checbox:
var name =$(this).closest('tr').fin d('td:eq(2 )').text() ;
$('#dialog-form input[name="available"]'). val(Empres a);
No matter if the box is checked or not it returns an empty value
When I programthe table the checkbox is either checked or not checked according to some databse value (1 or o)
var name =$(this).closest('tr').fin
$('#dialog-form input[name="empresa"]').va
No problem
However when I try to pass the vale of a checbox:
var name =$(this).closest('tr').fin
$('#dialog-form input[name="available"]').
No matter if the box is checked or not it returns an empty value
When I programthe table the checkbox is either checked or not checked according to some databse value (1 or o)
ASKER
Ok,,
it should read
$('#dialog-form input[name="empresa"]').va l(name);
you can see the script running:
http://parquevehicular.com/panelx/expertxx.asp#
it should read
$('#dialog-form input[name="empresa"]').va
you can see the script running:
http://parquevehicular.com/panelx/expertxx.asp#
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Now it does get the variable but when I do:
if (Ina === '1'){
$('#dialog-form input[name="ina"]').prop(" checked", true);
}
To set the checkbox in with the name ina as, ina='1' it wil always tke the one value, so the ina checkbox is always on.
if (Ina === '1'){
$('#dialog-form input[name="ina"]').prop("
}
To set the checkbox in with the name ina as, ina='1' it wil always tke the one value, so the ina checkbox is always on.
If lna is a number then this won't work
if (Ina === '1'){
Use
if (Ina == '1'){
if (Ina === '1'){
Use
if (Ina == '1'){
ASKER
Same result...
Once ina is set to 1 like it gets trapped
Once ina is set to 1 like it gets trapped
ASKER
Sorry,my mistake it does the trick.
ASKER
Pretty nifty
Thx
Thx
$('#dialog-form input[name="available"]').
What is Empresa?
Post some sample HTML