Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Sunday, July 22, 2018

Using jQuery vs more advanced JS frameworks


"Jquery results in mostly event handling and procedural code. The more advanced frameworks, if used properly end up more declarative with some event handling. That's much easier to write, read and understand."

Card

Monday, April 10, 2017

jquery: dropdown

http://stackoverflow.com/questions/2780566/get-selected-value-of-a-dropdowns-item-using-jquery

For single select dom elements, to get the currently selected value:
$('#dropDownId').val();
To get the currently selected text:
$('#dropDownId :selected').text();

Monday, March 20, 2017

What is hard to do using React.js compared to jQuery?

https://www.quora.com/What-is-hard-to-do-using-React-js-compared-to-jQuery

Just name a few that React is not good at

1. Async loading. Async loading is a must-have for Single Page App but React doesn't have a native support for Async loading.
2. Animation. You have to fall back to other library for animation.
3. Integration with other library. You don't want to rewrite all available cool library in React, do you?
 
When working with async loading, animation and integration with other jQuery library, you end up have too many work-around in your code and you can hardly call your framework React.

Saturday, March 18, 2017

Monday, March 14, 2016

Sunday, August 9, 2015

jQuery code to get the selected radio button (and its value)

jQuery code to get the selected radio button and its value

.val() - it looks like we should not use this for radiobuttons.

$('input:radio[name=rblist]').val() - this was giving the value of the radiobutton that was selected (checked) when the page loaded.
If I changed the selection, and then checked .val(), it was showing the previous value still. 

To get the selected radiobutton, I had to iterate over the list of radio buttons and check each one if it is checked or not.

$('input:radio[name=rblist"]').each(function(){ 
  if ($(this).is(':checked')) { 
    rb_value = $(this).val(); 
    console.log("Selected rb value = " + rb_value); 
  } 
});

Thursday, July 10, 2014

jquery: checkbox & radiobutton related

Is checkbox checked:
 if ($('#order_use_billing').is(':checked')){

}

Wiring up event-handler to Radiobuttons & checking which one was selected:
$('[name=use_existing_billing_address]:radio').change(function(){
  if ($('[name=use_existing_billing_address]:checked').val() == 'yes') {
   
  }
  else {
 
  }
}

Followers

Blog Archive