Thursday, 15 May 2014

javascript - Not able to get value using: this.$("#{INPUT_ELEMENT_ID}").val() in JS Framework -



javascript - Not able to get value using: this.$("#{INPUT_ELEMENT_ID}").val() in JS Framework -

generally, can utilize input_element_id value using jquery as:

$("#{input_element_id}").val();

which differ code: this.$("#{input_element_id}").val(); or same above line of code.

reason post question:

i wrote unit testing backbone application using jamine.js framework code coverage.

if backbone application's view has code: $("#{input_element_id}").val();, check input_element_id value.

but if application's view code has code: this.$("#{input_element_id}").val();, can not check value of input_element_id jasmine.js spec file.

(i used fixtures input_element_id value jasmine view spec.js file)

kindly help me, understand problem , resolve it.

thanks in advance.

$("#{input_element_id}").val();

used value id .

follwoing line wrong

this.$("#{input_element_id}").val();

we can write

$(this).val();

here same id or class utilize in above function . e.g: $(".word_span ").on("click", function (){ alert($(this).attr('title')); });

javascript jquery unit-testing backbone.js jasmine

No comments:

Post a Comment