Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

onChange vs. onclick

Explorer ,
Oct 08, 2013 Oct 08, 2013

this code is worked fine with onchange event.  Instead of onchange, i want to have the link below(<a id="myLink" href="##" onclick="whatsUp();">link text</a>) and work the same as onchange, meaning when i
click on the link text , i need to get the url.t_item?

<script type="text/javascript">
function whatsUp() {
document.medform.t_item.value)
}
function show() {
alert(document.medform.t_item.value)
}
</script>

<cfif isDefined("form.t_item")>

<cfdump var="#form#"><br />

</cfif>
   
<cfform name="medform" action="#cgi.SCRIPT_NAME#">
Item name: <cfinput autosuggest="cfc:cfc.gg.lookupArt({cfautosuggestvalue})" type="text" name="t_item" size="50" typeahead="yes"  onChange="whatsUp()">

<a id="myLink" href="##" onclick="whatsUp();">link text</a>

</cfform>

947
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 08, 2013 Oct 08, 2013

Looks pretty much ok, so what happens when you click on the link? There is a missing alert in your whatsUp() function but I think you know that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 02, 2013 Dec 02, 2013
LATEST

Your whatsUp() function appears to have a typo: I see a closing paren but no opeing one and I don't see what it doing anything even if you correct the stray paren. Maybe you meant to call alert()?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources