html-helper


Configure the Javascript function + Html Helper


Is there a way to configure a Javascript(which accepts few parameters) and initialize a function with user specified parameters in an unobtrusive way with data-attributes?
Any reference would be great help
InitializeLogging({
Url: "/xxx/yyyy",
x: 10,
y: true,
somevalue: false,
unHandledErrorCallback: function (message) {
console.log("Somerror message " + message);
}
});
We can achieve that in the following way,
HTML
Call a <br />
Call b
Script
var app = {
init: function(){
this.addEventListener();
},
a: function(){ alert("You have called 'a'"); },
b: function(){ alert("You have called 'b'"); },
callMethod: function(event){
var func = $(this).attr('data-attributes');
app[func].call();
},
addEventListener: function(){
$('a').on('click', this.callMethod);
}
};
$(document).ready(function(){
app.init();
});
Demo JS http://jsfiddle.net/DfHXs/2/
Hope this will help you.

Related Links

Converting C# Razor view syntax for checkboxlist into VB.Net
Table of content is not proper in chm file
Web helpers for MVC 5?
asp.net mvc3 or mvc4 html helper is not working
Configure the Javascript function + Html Helper
Displaying multiple values with Telerik ASP.Net MVC extensions with the ForeignKey column
Custom html helpers in MVC 4
Return multiple checkbox from Custom html helper in mvc 3r
Getting Class Property Values from Linq Expression In Html Helper MVC3
format htmlhelper date field to dd/mm/yyyyy
How to create internal Linking inside CHM help file
simple_html_dom timer?
Printing Html with razor view engine
How to set the default page for a .CHM file in HTML Help Workshop?
How can I use an HTML page as an email that reads as such in mail servers exactly as seen on the web?
Easiest way to open chm files programmatically?

Categories

HOME
bluetooth
atom-editor
include
relayjs
grep
youtube-dl
analysis
sharepoint-designer
v8
survey
multiple-records
maude-system
correlation
collectd
messages
ups
windows-7-x64
clickonce
dcevm
core-text
microsoft-r
hammerspoon
minitab
ping
assistant
jspm
windowbuilder
procdump
bpel
unboundid
directx-10
bcd
form-data
sequential
android-ble
objectlistview
xenforo
elasticsearch-plugin
tasker
bootstrap-dialog
user-accounts
mplayer
carrot
google-perftools
capacity
epson
flutterwave
gnome-shell-extensions
url-pattern
sts-springsourcetoolsuite
phishing
essence
livequery
system.management
natvis
separator
reactive-banana
jms2
endeca-workbench
collapse
jmeter-maven-plugin
dukescript
service-accounts
bigbluebutton
geonetwork
typekit
qpainter
codeigniter-url
file-copying
contenttype
p4java
mbr
viadeo
industrial
flexmojos
xsockets.net
bulkloader
easy-install
http-unit
robotics-studio
multipage
libc++
gnustep
coredump
coercion
invite
file-comparison
xfbml
gallio
sproutcore-2
memory-size
eqatec
sustainable-pace
uiq3

Resources

Encrypt Message