passing parameter to javascript onclick function

前端 未结 3 769
刺人心
刺人心 2021-01-28 18:40

I am having problem with getting parameter from javascript onClick function

title = \"as\"
$(\'
  • 3条回答
    •  耶瑟儿~
      2021-01-28 19:10

      title = "as"
      $('
    • ')

      See the added double quotes. "'+hello+'" Also double quotes over your pushRight function.

      Your code won't work because it render an invalid html as shown below.

    • See, there were no quotes before and after pushRight, also before and after your string "sa". Know the mistake and correct. Using inline js with html is not recommended.You have to bind events in these scenarios.

    提交回复
    热议问题