Sunday, 2 April 2017

node.js Jade javascript jquery not doing anything reasonable

This is my .jade file

extends layout
block content
  script(src="/jquery/dist/jquery.js")
  script(type="text/javascript").
    var x = $('#s').text;
    console.log('jquery', x);

  h1= title
  input(type="text", id="s", name="s", text="#{s}", value="#{s}")
  p
  p end

This is what gets written to the console:

jquery function ( value ) {
        return access( this, function( value ) {
            return value === undefined ?
                jQuery.text( this ) :
                this.empty().each( function() {
                    if ( this.nodeType === 1 || this.nodeTyp…

The text input get filled correctly when rendered by the router.

Why can't this just given me the text (or value for that matter because I tried that too) of the input?



via Steve

No comments:

Post a Comment