Set an input with a wordpress php value

Set an input with a wordpress php value

      Hello everyone,
First of all I am not a Jquery or JS expert so I don't really know if my code is wrong or if that's just a calling issue...
I  have to set an input value depending on the element clicked on my page, using the_title(); wordpress function. I wonder if someone already had the same kind of issue. Here is my script called in my template page where the link is written and the form shortcode is called too : 

  1.   function postuler_js(){ 

  2. sujetpostuler = the_title();
  3. $("#postulerBouton").click(function (e) {
  4.   $("#sujet").val( sujetpostuler );
  5.   oFormObject = document.elements["your-subject"].value = sujetpostuler; 
  6. });  
  7. }
And the link and my calling is like this :

  1. function postuler_import(){
  2. wp_enqueue_script( 'postuler',
  3. get_stylesheet_directory_uri() . '/js/postuler.js',
  4. array() );

  5. }
  6. add_action( 'wp_footer', 'postuler_import' );

  1. <a class='postuler' id='postulerBouton' title='bouton postuler' href='#' onclick='postuler_js();'>Postuler</a>
      I wish that someone could give me a hint or the problems in my code because that's not working at all,
we just get back to the top of the page...

Thanks for reading this and have a nice day anyway.