Jquery Methods: //this Is Used To Refer To The Currently Selected Element
Jquery Methods: //this Is Used To Refer To The Currently Selected Element
Jquery Methods: //this Is Used To Refer To The Currently Selected Element
To select an element.
$(element*filter1+*filter2+ sub-element[filter1][filter2])
Each filter is an attribute value pair. Eg input*type=checkbox+*title=Abstract+
Setting event methods
$(select and elemnt).on(eventName,function(), -);
Event names can be= hover, click, change etc. in function write your custom code.
Understand the following code for reference
$("input[type='checkbox'][title='Abstract']").on('change',function(){
//this is used to refer to the currently selected element
if($(this).prop('checked'))
{
var subType=$("select[title='Submission type']");
var firstOption=$("select[title='Submission type'] option:first").val();
if(!(firstOption==new String('Abstract').valueOf()))
{
// append abstract
subType.prepend("<option value='Abstract'>Abstract</option>");
}
//disabling what is selected
$("select[title='Submission type'] option:selected").prop('selected',false);
//selecting abstract
$("select[title='Submission type'] option:first").prop('selected','selected');
}
else{
var firstOption=$("select[title='Submission type'] option:first").val();
if(firstOption==new String('Abstract').valueOf())
{
//remove abstract from drop down
$("select[title='Submission type'] option[value='Abstract']").remove();
}
//select first value as default value;
$("select[title='Submission type'] option:selected").prop("selected",false);
$("select[title='Submission type'] option:first").prop("selected","selected");
}
});