JavaScript Connecting HAML simple_form with javascript

I have something like this:

  = f.input :payment_date, as: :date
  = f.input :tuitor, as: :boolean, label: 'Tuitor payment'

and I want use on this a simple JavaScript like this:

costam = ->
if document.getElementById('datet').checked is true
  document.getElementById('pdate').disabled = false
else
  document.getElementById('pdate').disabled = true
return

How I can put 'datet' and 'pdate' in my HAML form? I was trying options like

:id => "pdate"

or

id: :pdate

but it's not working.

Answer:1

I was racking my head for a whole night trying to figure out why my code isn't working. I copied the code 2 times but the result was the same. The problem was sometimes when the snake eats an apple, ...

I was racking my head for a whole night trying to figure out why my code isn't working. I copied the code 2 times but the result was the same. The problem was sometimes when the snake eats an apple, ...

  1. snake game not working
  2. snapchat snake game not working
  3. google snake game not working
  4. working snake game

When I do new Date() I get: Thu Dec 28 2017 10:17:58 GMT+0800 (台北標準時間) If I apply .valueOf() to that date I get: 1514427724039 Which is what I want. Now, I need to apply .valueOf() to a date ...

When I do new Date() I get: Thu Dec 28 2017 10:17:58 GMT+0800 (台北標準時間) If I apply .valueOf() to that date I get: 1514427724039 Which is what I want. Now, I need to apply .valueOf() to a date ...

I am trying to change element class or any css property while dragging and it depends on elements position. So this is what i got so far: https://jsfiddle.net/twfegqgc/ So it changes when element ...

I am trying to change element class or any css property while dragging and it depends on elements position. So this is what i got so far: https://jsfiddle.net/twfegqgc/ So it changes when element ...

  1. change element class javascript
  2. change element class jquery
  3. change element class name javascript
  4. change element class on click
  5. change element class
  6. change element class angular
  7. change element class react
  8. change element class typescript
  9. change element class css
  10. change element class php
  11. change element class name
  12. change element class html
  13. change element class angularjs
  14. change element class in media query
  15. change element class using jquery
  16. javascript change element class
  17. change class element by id
  18. change class element vue
  19. change html element class javascript
  20. angular change element class on click

In my app.js file I have I am exporting an object with properties and values. On the route, I am including the file but I am getting the value as undefined. If I don't pass in the argument "users" in ...

In my app.js file I have I am exporting an object with properties and values. On the route, I am including the file but I am getting the value as undefined. If I don't pass in the argument "users" in ...

  1. undefined value from json
  2. value undefined in javascript
  3. value undefined in jquery
  4. value undefined in angular
  5. value undefined in php
  6. undefined value in math
  7. value of undefined
  8. undefined value in javascript object
  9. undefined value in python
  10. undefined value in array javascript
  11. undefined value in java
  12. undefined value in js
  13. undefined value in mongodb
  14. undefined value in excel
  15. undefined value in ajax
  16. undefined value in c#
  17. undefined value in perl
  18. undefined value in typescript
  19. undefined value in html
  20. ng model value undefined