function my_alert() {
alert("Hello");
}
If the above is inside a partial, it doesn't work when I call my_alert() from a onclick event of a button on the partial; it is as if the function is not defined. But if the above is inside the parent, it works.
However, if I change the function definition to below:
my_alert = function my_alert() {
alert("Hello");
}
It works if it's defined in a partial (But it doesn't work in IE).
If I just throw the below on a view:
alert("Hello");
It will show the alert message no matter it's on the partial or the parent.
I need to do more research on this. I think as long as the defined function is shown on page source, it should work. Can I have a script
section inside a div?
36 comments:
may the blessing be with you.........................................
人生是故事的創造與遺忘。......................................................
先告訴自己希望成為什麼樣的人,然後一步一步實踐必要的步驟。........................................
April showers bring May flowers. ........................................
I love readding, and thanks for your artical. ........................................
Thank you for Posts~............................................................
喜歡你的部落格,留言請您繼續加油.............................................
your english is incredible............................................................
The shortest answer is doing. ............................................................
找一個懂妳的人也期許自己做一個人懂別人的人 ..................................................
你不能改變容貌~~但你可以展現笑容..................................................................
好文章給我好心情,謝謝分享~~ .................................................................
在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」......................................................................
死亡是悲哀的,但活得不快樂更悲哀。......................................................................
生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。......................................................................
成熟,就是有能力適應生活中的模糊。.................................................................
It takes all kinds to make a world.............................................................
安安!剛開始玩這個,來這裡逛一下^^............................................................
要拼才會贏,生活就像戰爭…什麼時候才有和平啊…>"<..................................................
一個人的際遇在第一次總是最深刻的,有時候甚至會讓人的心變成永遠的絕緣。............................................................
人生之中,比冒險更危險的一件事:不去冒險。..................................................
良好的開端,已是成功的一半。.......................................................
Offence is the best defence...................................................
.有價值的東西,都要付出代價。-................................................
愛情是一位偉大的導師,教我們重新作人..................................................................
老天爺賦予了強者的能力,就是要他比弱者多擔待.......................................................
你的部落格不錯哦,支持!!!!@@ ..................................................................
人生是一連串的課程,必須活過才能明白。.......................................................
新手上路哦~請大家多支持(・ˍ・*) ............................................................
真正仁慈的人,會忘記他們做過的善行,他們全心投入現在的工作,過去的事已被遺忘。.................................................
與朋友在一起,分擔的痛苦是減半的痛苦,分享的快樂是加倍的快樂。......................................................................
看著你的BLOG 好多朋友都回應 真厲害..................................................
這麼用心的經營你的文章, 當然值得我們留連拜訪的!...............................................................
唯有用熱情、用智慧去觀察事物,這事物才會把他的秘密,洩漏給我們......................................................................
感動 + 感恩 + 感謝(。-ˍ-。 )............................................................
Post a Comment