Learning from tasks and Merge Sort JavaScript


Do not use html tag to bind event straightaway. It will cause serious problem. Try to use class or Id

For writing JavaScript method or Jquery method, if we want to pass a element to a method, we use this.

Example:

function hello(element){

//do something with the element we just passes in we can use dom or jquery to have the access to this element

$(element).color(“red”)

//or

element.innerHTML = “Hi”

}

<button onclick=”hello(this)”>hello</button>

 

Also, for any ajax call (.get,.post,.ajax), we have to make sure all data we want to pass into a action in a controller should match the parameters of an action. Otherwise, the routing mechanism cannot locate that url.

 

Social Media


Categories



All Posts



Contact Info